Andrej van der Zee wrote:
Hi,
Thanks for your comments. See below...
Worker mpm is a multithreaded, multiprocess mpm. Multiple child processes
host multiple worker threads that run your module code.
If your module services 2 concurrent requests in 2 different threads in the
same process and both the threads need to access critical code at the same
time, you will have to use thread locking to prevent race conditions.
Yes, I understand the concept of mpm worker. My point was slightly
different: When I start a background thread in the post_config()-hook, it is
created in the address space of the server, and not of the processes that
run worker threads for handling HTTP requests. Therefore, threads that
handle HTTP requests always execute in a different process than the
background thread, and thus thread-based locking is not necessary for
sharing inter-process data.
My point is that within a single process, multiple threads can service
requests that can end up firing your module code. If you only do process
locking you can still have more than 1 thread executing your module code
at the same time.
Just a process level lock will *not* guarantee that only a single thread
is executing your code within the process holding the lock. A inter
thread lock is needed to synchronize multiple threads within that
processes from stomping on a shared resource.
srp
--
http://saju.net.in