Semaphore wrapper and example.