apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: flock() does not work in Apache2 module.
Date Thu, 08 May 2003 17:55:22 GMT
Dmitri Tikhonov wrote:
> I've run into an interesting problem: my module needs to read
> configuration from a file that is occasionally changed by another process.
> I've created a test C program that reads configuration if it can obtain a
> lock using flock(2) function:
>     if (-1 == flock(fd, LOCK_SH|LOCK_NB)) {
>         /* Could not lock... go with old config. */
>         return -4;
>     }

Perhaps you mean that multiple threads in the same process calling into 
your module can the flock() mutex simultaneously?

I strongly suggest using APR locks, which do the right thing w.r.t. 
threads and processes.

View raw message