Boost logo

Boost :

Subject: Re: [boost] [thread] semaphore
From: Tim Blechmann (tim_at_[hidden])
Date: 2013-09-21 03:38:37


>> sorry, but i strongly disagree: i think that boost is the place for
>> high-performance code, that power users can rely on. i don't know how
>> many `power users' have to maintain abstractions for low-level
>> primitives. regarding semaphores, can you please mention one operating
>> system, that does not support them natively?
>
> I agree. But we should also try to guess what memory order guarantees
> should a boost/standard semaphore offer. Interprocess currently uses
> full-fence operations on spin-semaphores (just like in other primivites,
> like mutexes, which is too strong for mutexes and maybe for semaphores).
>
> To be used as a binary semaphore, I guess wait()/post() could be just
> acquire/release. But I don't know if this applies to counting semaphores
> (and specially get_value(). I can read an old thread on this:
>
> https://groups.google.com/forum/#!topic/comp.programming.threads/HpUwUUjgLK8

i was also under the impression that wait/post should be
acquire/release, both for semaphores and for events. get_value() may
need some special care, but i'm not planning to add this to the
sync::semaphore interface, because it is not widely supported: neither
mach nor dispatch semaphores provide an API for accessing the semaphore
count.

cheers,
tim




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