fork download
  1. # your code goes hereimport gevent
  2. from gevent.queue import Queue
  3.  
  4. tasks = Queue()
  5.  
  6. def worker(n):
  7. while not tasks.empty():
  8. task = tasks.get()
  9. print('Worker %s got task %s' % (n, task))
  10. gevent.sleep(0)
  11.  
  12. print('Quitting time!')
  13.  
  14. def boss():
  15. for i in xrange(1,25):
  16. tasks.put_nowait(i)
  17.  
  18. gevent.spawn(boss).join()
  19.  
  20. gevent.joinall([
  21. gevent.spawn(worker, 'steve'),
  22. gevent.spawn(worker, 'john'),
  23. gevent.spawn(worker, 'nancy'),
  24. ])
Runtime error #stdin #stdout #stderr 0.01s 7892KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 2, in <module>
ImportError: No module named gevent.queue