Semaphore - state pattern example