Move to System V semaphores

They have the crucial ability to reset when a process terminates erroneously.
Add OSX support