Implement blocking queue using semaphore