how to implement semaphores for state machines

?source=rss----3a8144eabfe3---4