Created
August 16, 2013 06:25
-
-
Save whiteclover/6247727 to your computer and use it in GitHub Desktop.
gevent q demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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