Skip to content

Instantly share code, notes, and snippets.

@senhorinha
Created July 7, 2013 18:01
Show Gist options
  • Save senhorinha/5944351 to your computer and use it in GitHub Desktop.
Save senhorinha/5944351 to your computer and use it in GitHub Desktop.
Semaphore barbeiro = 1
Semaphore acentos = 1
Semaphore pronto = 0
def Barbeiro():
while true:
wait(acentos)
sleep(random(10)
signal(pronto)
def Customer():
while true:
wait(barbeiro)
wait(pronto)
signal(barbeiro)
signal(acentos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment