Added mutexes and semaphores on posix/windows.