Basic semaphore worked out