Use semaphore to slow down main thread