Simplify semaphore implementation