Simple semaphore implementation