httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Querna <c...@force-elite.com>
Subject Re: Getting pool associated with current thread/child
Date Sun, 08 Feb 2009 23:54:53 GMT
Brian McCallister wrote:
> 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?

no, because there isn't a portable way to do it, and in addition it
would be an out of order pool destruction with the other pools, likely
causing other issues.

I think doing it via the mpm/extending the request rec is the right way
to do it, and I don't understand why there is resistance to just doing
it that way?


> 
> On Sun, Feb 8, 2009 at 10:22 AM, Brian McCallister <brianm@skife.org> wrote:
>> On Sat, Feb 7, 2009 at 5:47 PM, Graham Leggett <minfrin@sharp.fm> 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
>>> --
>>>


Mime
View raw message