Skip to content

Instantly share code, notes, and snippets.

@schmir
Created March 18, 2011 14:58
Show Gist options
  • Save schmir/876204 to your computer and use it in GitHub Desktop.
Save schmir/876204 to your computer and use it in GitHub Desktop.
from gevent import spawn, event, sleep
count = 0
ev = event.Event()
def doit():
global count
ev.wait()
count += 1
for i in range(500):
spawn(doit)
sleep(0.1)
ev.set()
ev.clear()
sleep(0.1)
assert count==500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment