Thanks noufal, I got it.
After gevent.spawn, we have to do join or gevent.joinall or gevent.sleep or patched library call to start the greenlets, right ? I have see the code which not using any of these after gevent.spawn, How it is working there ? https://github.com/Juniper/contrail-controller/blob/master/src/opserver/uveserver.py#L656 Thanks, On Sun, Jun 21, 2015 at 1:01 PM, Noufal Ibrahim KV <nou...@nibrahim.net.in> wrote: > On Sun, Jun 21 2015, anu sree wrote: > > > [...] > > > This code has two pause (gevent.sleep(0)), in Consumer.start and > > Worker.run. Here control goes to Worker.run when Consumer.start > > pauses and Consumer.start gets control back when Worker.run > > pauses. There may be benefit from this switching, but I am still not > > understanding it. > > [...] > > The idea is that any non blocking call is an opportunity to switch > between greenlets. The monkey patching system will enable this. > > If you don't have any place in your greenlets that are monkey patched > (and therefore allow switching), you can be a good citizen and drop in a > patched sleep call so that other greenlets will get time to > run. Otherwise, you'll simply hog the interpreter and no one else will > be able to run. > > This the principle. I still don't understand your question. > > > -- > Cordially, > Noufal > http://nibrahim.net.in > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > https://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers