Fwd: Race in dispatch_semaphore_wait(DISPATCH_TIME_NOW)
(forwarding to list) Hi Dave, On Wed, May 21, 2014 at 8:54 PM, Dave Zarzycki <zarzycki@apple.com> wrote:
This is almost surely a bug in the port to these platforms. Apple’s operating system uses Mach to implement this feature, but Mach is not available on Linux and Solaris.
AFAIU libdispatch on OS X uses Mach semaphores instead of POSIX ones used on Linux/Solaris. But the issue is irrelevant to OS semaphore implementation. Actually I tried to reproduce it on OS X using (named) POSIX semaphores but failed. I.e. the same (racy) code that hangs on Linux/Solaris doesn't hang on OS X. I even tried simple semaphore implementation using mutex+condition variable but again no luck on OS X. My guess is that this is related to differences in thread scheduler implementations on these OS'es.
participants (1)
-
Dmitri Shubin