Boost logo

Boost :

Subject: [boost] [thread] semaphore
From: Tim Blechmann (tim_at_[hidden])
Date: 2013-07-08 05:04:43


hi all,

i've submitted an implementation of semaphores for boost.thread to trac
[1]. they provide an interface similar to boost.interprocess semaphores,
with the exception of having chrono-style try_wait_for and
try_wait_until members for timed_wait.

the patch provides the following implementations:
* win32 semaphores (tested with windows 8)
* posix semaphores (tested with linux)
* dispatch semaphores (tested with osx 10.8)
* mutex/condition_variable/counter emulation

the native implementations are much faster than the fallback, in
microbenchmarks with high contention, i've seen a speedup of 30 to 80.

would be great if they can be incorporated into boost.thread.
comments/suggestions on the API are highly appreciated.

cheers,
tim

[1] https://svn.boost.org/trac/boost/ticket/8797




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk