[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.1 threads, environments, and 5.2
- From: Tony Finch <dot@...>
- Date: Tue, 12 Apr 2011 10:23:56 +0100
Anthony Howe <achowe+lua@snert.com> wrote:
>
> Now since hook.request has had its environment forced to be the same as
> the thread's environment by the C layer, the hook.request function can
> access the client table in the thread space without issue. BUT function
> calls from within hook.request to supporting application functions will
> throw an error when they try to access client table, because the
> function call chain does not inherit that of the caller or thread space
> in which it executes. This is the essence of my problem.
Why not just pass the client info table to the hook as an argument?
Just have a state object (i.e. table) per connection. No need to create a
coroutine thread per connection unless you want a persistent thread of
control. Your talk about hooks and callbacks suggests to me that you do
not have a per-connection thread of control in your client code.
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
Trafalgar: Easterly or northeasterly 5 to 7, perhaps gale 8 later in southeast
Trafalgar. Moderate or rough. Mainly fair. Good.