testing inside of the semaphore