add semaphore lock