<s> import gevent <EOL> def worker ( i ) : <EOL> if i == <NUM_LIT:2> : <EOL> raise ValueError ( i ) <EOL> return i <EOL> def main ( ) : <EOL> finished = <NUM_LIT:0> <EOL> done_worker = gevent . spawn ( worker , "<STR_LIT>" ) <EOL> gevent . joinall ( ( done_worker , ) ) <EOL> workers = [ gevent . spawn ( worker , i ) for i in range ( <NUM_LIT:3> ) ] <EOL> workers . append ( done_worker ) <EOL> for g in gevent . iwait ( workers ) : <EOL> finished += <NUM_LIT:1> <EOL> gevent . sleep ( <NUM_LIT> ) <EOL> assert finished == <NUM_LIT:4> <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
