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.




Reply via email to