Skip to content

Instantly share code, notes, and snippets.

@whiteclover
Created August 16, 2013 06:25
Show Gist options
  • Save whiteclover/6247727 to your computer and use it in GitHub Desktop.
Save whiteclover/6247727 to your computer and use it in GitHub Desktop.
gevent q demo
from gevent import queue
q = queue.Queue()
def queue_put(msg):
q.put_nowait(msg)
def queue_get():
return q.get()
if __name__ == '__main__':
print "starting ...."
for i in range(10):
queue_put(i)
while True:
try:
msg = queue_get()
print msg
except:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment