Making changes to the threading, mutex and semaphore APIs