Can now compile on OSX, also fix issues reported by llvm, as well as relative wait on semaphore