macOS lacks unnamed semaphore implementations. As named semaphores are not private, they're not realiable as they can be controlled publicly via name. I see DispatchSemaphore is implemented using `sem_init` which is unnamed semaphores. It seems unnamed semaphores are allowed only for system code. If DispatchSemaphore is simply a wrapper around pthread unnamed semaphore, it would be safe to use them to control pthread. But as it is a GCD level object, I actually don't know whether they're actually safe for pthread.
Is it safe to use DispatchSemaphore with pthread stuffs?