Use Mach semaphores on Darwin
authorChip Davis <chip@holochip.com>
Thu, 30 Jun 2022 00:34:45 +0000 (19:34 -0500)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Fri, 16 Sep 2022 15:32:41 +0000 (15:32 +0000)
commit68b1ca6946c3bf29be3f18d1b9d3e9794053f54b
tree4efc5c18c273cc8b243be91c3e3102f198e6119d
parent0a2101e7cb07e49298e1e751fefd05ce04c5e92c
Use Mach semaphores on Darwin

Using named POSIX semaphores presents a problem: since they are visible
to other processes, they don't get cleaned up automatically when the
process dies. This causes problems down the line when the POSIX
semaphore namespace is filled up (macOS, by default, only allows 10000
POSIX semaphores to exist at once): creating new semaphores fails, and
thus we die with a null pointer reference when we try to use the
semaphore.

Mach semaphores have none of these problems. And no, I have no idea why
Apple doesn't just implement anonymous POSIX semaphores on top of Mach
semaphores. Maybe they thought it would be too hard to distinguish named
from unnamed semaphores?

Components: Framework
VK-GL-CTS public PR: 350

Change-Id: Id2b5a05b8afe96c5d9999417b0fcd1f96ddb7ba3
AndroidGen.mk
framework/delibs/dethread/CMakeLists.txt
framework/delibs/dethread/unix/deSemaphoreMach.c [moved from framework/delibs/dethread/unix/deNamedSemaphoreUnix.c with 53% similarity]