Wait until one of several greenlets finished
问题 I have two functions that receives data from two different connections, and i should close both connections after getting result from one of them. def first(): gevent.sleep(randint(1, 100)) # i don't know how much time it will work return 'foo' def second(): gevent.sleep(randint(1, 100)) # i don't know how much time it will work return 'bar' Then i spawn each function: lst = [gevent.spawn(first), gevent.spawn(second)] gevent.joinall blocks current greenlet until both two greenlets from lst