Skip to content

Instantly share code, notes, and snippets.

@michelp
Created July 3, 2012 04:24
Show Gist options
  • Save michelp/3037710 to your computer and use it in GitHub Desktop.
Save michelp/3037710 to your computer and use it in GitHub Desktop.
from gevent import Event
from itertools import ifilter
from operator import methodcaller
def eselect(events, timeout=None):
waiter = Event()
for e in events:
e.rawlink(waiter.set)
waiter.wait(timeout)
return ifilter(methodcaller('is_set'), events)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment