Re: PerlModule lifetime / threads

2010-05-20 Thread Perrin Harkins
On Thu, May 20, 2010 at 11:17 AM, Some Guy wrote: > If the MPM is threaded, a rwlock is used where the cleanup obtains the > writelock and request handlers are obtaining a read lock. You don't need to do this. Variables are not shared between perl threads unless you make them shared. If you avo

Re: PerlModule lifetime / threads

2010-05-20 Thread Some Guy
I tried the cleanup handler solution, and threw a sleep in there for ha has. Basically I do the following in my handler: Register a cleanup on the request's pool Check if I need to do something to the user agent if it is found in an array that is backed by a data file If it's not in the array, de

Re: PerlModule lifetime / threads

2010-05-20 Thread Some Guy
This module is meant for other parties to use, so I can't define what MPM they use. I would like it to work in either case. I don't mind throwing in locking logic based on the results of querying whether the MPM is threaded or not - I just want to better understand that scenario and how it applie

Re: PerlModule lifetime / threads

2010-05-20 Thread Michael Peters
On 05/20/2010 08:54 AM, Some Guy wrote: The cleanup handler is a brilliant idea. That removes the need for a polling thread. If I attach the cleanup to the request's pool and run in a threaded MPM, this led to contention for the globals that I'm updating in C. Is this the case with PerlModules

Re: PerlModule lifetime / threads

2010-05-20 Thread Some Guy
The cleanup handler is a brilliant idea. That removes the need for a polling thread. If I attach the cleanup to the request's pool and run in a threaded MPM, this led to contention for the globals that I'm updating in C. Is this the case with PerlModules, or can I get away without locking them?

Re: PerlModule lifetime / threads

2010-05-19 Thread Perrin Harkins
On Wed, May 19, 2010 at 4:37 PM, Some Guy wrote: > if I have a ChildInitHandler, any changes I make to globals are not > reflected in a HeaderParserHandler.  My globals do not have the :shared > attribute - must they? Only if you're trying to update them from a different thread. If there aren't

PerlModule lifetime / threads

2010-05-19 Thread Some Guy
Hey all, I am trying to port a module I wrote in C to one that uses mod_perl. The C module would spawn a thread in the child_init process and poll a file. The file polled contained data that the header parser phase would use. I protected the data via a RW Lock. Now when doing this in mod_perl