Mac OS X: add semaphore implementation