|
Boost : |
From: Glenn Schrader (gschrad_at_[hidden])
Date: 2006-12-16 14:10:07
Hello Ion,
Ion Gaztañaga wrote:
> Hi Glenn,
>
> Glenn Schrader wrote:
>
>> I ran across this bug while running on a 2.6.9 Linux kernel. Since that
>> kernel version doesn't have native interprocess mutexes and condition
>> variables the interprocess library uses some emulation code. The x86
>> verion of the emulated semaphore uses atomic_dec32() from atomic.hpp but
>> that function wasn't behaving properly. The following change in
>> oost/interprocess/detail/atomic.hpp made things work properly:
>>
>
> Thanks for the change. However, I'm pretty sure that Linux has
> process-shared mutexes and condition variables. This might be a bug from
> the last version. Can you check against the CVS code?
>
Since interprocess isn't in the official tarball yet i've been working
with the head version from CVS. Whether or not emulation is used is
determined by the value in _POSIX_THREAD_PROCESS_SHARED. In a 2.6.17
kernel that I'm running on another system the value is 200112L so indeed
the native mutexes and condition variables are used. The system that I
was having a problem with has a 2.6.9 kernel and the
_POSIX_THREAD_PROCESS_SHARED value of -1; corresponding to "not supported".
> I will apply your patch ASAP to CVS. This really shows that atomic
> functions in hands of non expert people like me are really dangerous!
> Let's hope we can see soon an atomic operations library in Boost.
>
No problem and and thanks!
-glenn
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk