Thanks naufal and Krace. I have tried following code. I have given gevent.sleep(0.1), that means each greenlet let others to execute 0.1 secoond. But here each greenlet waiting for others to complete, why? Is it because of greenlet.joinall ?
Here I have created 3 greenlet threads (A, B, C). I think, A is the parent greenlet, right ? Once C get finished control should goes to B, right ? But here it going to A. Please check the ouput. import gevent def task(num): thread_id = id(gevent.getcurrent()) print "Start: ", num, thread_id for i in range(100000001): if i == 100000000: print num + str(i) gevent.sleep(0.1) for i in range(100000001): if i == 100000000: print num + str(i) print "End: ", num, thread_id threads = [gevent.spawn(task, x) for x in ['A', 'B', 'C']] gevent.joinall(threads) Output ======= Start: A 139984038735696 A100000000 Start: B 139984008421616 B100000000 Start: C 139984008421776 C100000000 A100000000 End: A 139984038735696 B100000000 End: B 139984008421616 C100000000 End: C 139984008421776 _______________________________________________ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers