Semaphore manipulation utility