Implement mutex using semaphores
Use a mutex for locking
Fix copyright