semaphores now pointers; changes to make work on OS X; still need to changed semaphores to be named