httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saju Pillai <saju.pil...@gmail.com>
Subject Re: custom background thread and module sharing a data structure
Date Wed, 11 Mar 2009 08:15:34 GMT
Sorin Manolache wrote:
> On Wed, Mar 11, 2009 at 02:08, Andrej van der Zee
> <andrejvanderzee@gmail.com> wrote:
>> Hi,
>>
>> I need to modify Apache and run one custom background thread. In addition,
>> my custom modules have to be able to share a data structure with this
>> background thread. Did anybody do this before? Is there an example I can use
>> as a starting point?
> 

> 
> Regarding the shm protection against inconsistency: Now here are some
> details that I don't remember. There are some mutex mechanisms in
> apr_thread_mutex and in apr_proc_mutex. The first protects against
> concurrent access of threads in the same process, the second against
> concurrent access by processes. I remember I used the first, but I
> don't remember why and how did I avoid corruption by concurrent
> accesses of different processes.
> 

For the worker mpm, both cross thread and cross process protection will 
be needed. apr_proc_mutex.h family supplies cross-process protection, 
apr_thread_mutex.h provides cross thread protection.

You "locking" method would be a wrapper method that first obtains a 
process level lock, and then inside that lock it obtains a thread level 
lock.


srp
-- 
http://saju.net.in

Mime
View raw message