diff options
author | wm4 <wm4@nowhere> | 2014-09-10 03:09:41 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-09-10 03:24:19 +0200 |
commit | 564b957cc31a33124a935ea8678e5bbb710fc082 (patch) | |
tree | 5e980c428eaba4bf2a788ba0d5dee514763e252d /input | |
parent | ae63702a2c5bad0e943b84d05a4c6559052d11e7 (diff) |
osdep: add POSIX semaphore emulation for OSX
OSX is POSIX conformant, but it's a sad joke: it provides the
<semaphore.h> prototype as the standard demands, but they're empty
wrappers, and all functions just return ENOSYS.
Emulate them similar to how osdep/io.h emulate filesystem functions on
Windows. By including the header, working sem_* functions become
available.
To make it async-signal safe, use a pipe for wakeup (write() is AS-safe,
but mutexes can't be). Actually I'm not sure anymore if we really need
AS-safety, but for now the emulation can do it.
On Linux, the system provides a far more efficient and robust
implementation. We definitely want to avoid using the emulation if
possible, so this code is active on OSX only. For convenience we always
build the source file though, even if the implementation is disabled and
no actual code is generated.
(Linux provides working semaphores, but is formally not POSIX
conformant. On OSX it's the opposite. Is POSIX a complete joke?)
Diffstat (limited to 'input')
0 files changed, 0 insertions, 0 deletions