Re: [BangPypers] real use case of gevent context switch gevent.sleep(0)

2015-06-21 Thread anu sree
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 ?

Re: [BangPypers] real use case of gevent context switch gevent.sleep(0)

2015-06-21 Thread Noufal Ibrahim
On 2015-06-21 19:48, anu sree wrote: 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 ? join (and joinall) will pause the current greenlet till the ones you've joined terminate (similar

Re: [BangPypers] real use case of gevent context switch gevent.sleep(0)

2015-06-21 Thread Noufal Ibrahim KV
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

Re: [BangPypers] real use case of gevent context switch gevent.sleep(0)

2015-06-21 Thread anu sree
Hi Krace, I am still not understanding from code (practical example) where we are getting the benefit of PAUSE and let other greenlet to execute. I have created a simple worker program from your example