Add __APPLE__ guard around prctl

Not a great permanent fix, but solves the problem for now.
Switch to named semaphores to appease OS X