[libdispatch-dev] [PATCH 09/17] portability

Kevin Van Vechten kvv at apple.com
Fri Oct 30 12:21:20 PDT 2009



On Oct 30, 2009, at 11:18 AM, Paolo Bonzini wrote:

> On 10/30/2009 07:14 PM, Kevin Van Vechten wrote:
>> Based on the above discussion it seems like we may need to make
>> dispatch_semaphore_t be a thinner wrapper around OS semaphores on
>> platforms where the semaphore's handle cannot be atomically exchanged
>> — i.e. we may need to forgo the optimization of lazily allocating the
>> OS semaphore.
> 
> Yep.  OTOH, on Linux you'd probably want to use futexes which perform the same optimization (if you don't do the system call, the futex is just an "int").  So long-term some of these wrappers would move into src/shims.
> 
> Let's just leave aside this fix.

To be clear, the posix semaphore implementation is currently broken due to this race condition.

Kevin


More information about the libdispatch-dev mailing list