title: Python Event loop w/ gevent
body: <pre><code>import gevent
  from gevent.event import AsyncResult
  import time
  
  class Job(object):
      def __init__(self, name):
          self.name = name
  
  def setter(job):
      print 'starting'
      gevent.sleep(3)
      job.result.set('%s done' % job.name)
  
  def waiter(job):
      print job.result.get()
  
  
  # event loop
  running = []
  for i in range(5):
      print 'creating'
      j = Job(i)
      j.result = AsyncResult()
      running.append(gevent.spawn(setter, j))
      running.append(gevent.spawn(waiter, j))
  
  print 'started greenlets, event loop go do something else'
  time.sleep(5)
  gevent.joinall(running) 
  </code></pre>
  
  <p>gevent doesnt actually start until <code>joinall</code> is called  </p>
  
  <ul>
  <li>Is there something that would start/spawn gevent asynchronously (why does it not start right away as soon as spawn is called)? </li>
  <li>Is there a <code>select</code>/epoll on running greenlets to see which one needs to be joined instead of <code>joinall()</code>?  </li>
  </ul>