httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Micha Lenk <>
Subject Re: How to wait on a global lock with timeout
Date Sat, 16 May 2015 15:22:30 GMT
Hi Yann,

Am 25.03.2015 um 09:56 schrieb Yann Ylavic:
>> To mitigate that design flaw I would provide the timeout by reference
>> and update it by the functions using it. This has also the nice benefit
>> that the caller is able to retrieve the time it needed to wait.
> By doing so, you have to get the current time (call apr_time_now())
> each time, and I wanted to avoid it when the native functions don't
> need it.
> The remaining time is not important if you can pass an absolute time (IMHO).

Ok, understood. You're right.

Sorry, took me a while to give your patch a try. As the patch didn't
apply cleanly to trunk (ie. SVN rev. 1676013), I assume that it is
already applied in trunk. So I went ahead without applying your patch.
Is this correct?

I wrote a small test program that should prove me that timed global
locks work across process boundaries (see attached source). But for some
reason apr_global_mutex_unlock() return 1 if called in the child
process. This is the output that I get from the compiled test program:

Trying to get locked mutex... timed out after 1 second (expected)
Child trying to unlock the mutex got 1 (unexpected)
Trying to get locked mutex... timed out after 2 seconds (unexpected)

Did I do anything wrong?

Best regards,

View raw message