An alternative, for my need, is to be able to add a cleanup hook to the current thread. I can then just create a pool and put it in a thread local (you can do that with just the os thread in apr). I cannot find a way to actually register a cleanup for the threadlocal you set, though.
Is there one which I am missing? On Sun, Feb 8, 2009 at 10:22 AM, Brian McCallister <[email protected]> wrote: > On Sat, Feb 7, 2009 at 5:47 PM, Graham Leggett <[email protected]> wrote: >> Brian McCallister wrote: >> >>> So, in mod_lua I need to get the apr pool associated with the current >>> thread (that being the main thread if in prefork). >> >> What about the process_rec structure? >> >> In other words, r->server->process->pool? > > I thought this was one-per-process, where process is a real process. I > need one-per-thread in in worker/event so that they don't step on each > other. > > What I am looking for is to attach a lua_State instance to that pool, > so that when the thread is retired, I can hook into cleanups, and so > that I can attach the lua_State to the pool as userdata, to retrieve > it later. > > In prefork, a process level pool would work fine, but AFAIK this is > not a thread-safe thing. > >> >> (Not sure if this is what you are looking for, but a quick glance at the >> headers would suggest it probably does). >> >> Regards, >> Graham >> -- >> >
