httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrej van der Zee <>
Subject Re: custom background thread and module sharing a data structure
Date Fri, 13 Mar 2009 15:56:47 GMT

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.

re: Using non APR locking mechanisms - sure they will work as long as you
> are using compatible mechanisms (like if apr_threads is based on pthreads,
> the alternate locking mechanism should work with pthreads).

That's good news!


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message