events - How to properly block code execution in Python? -


i need block execution of greenlet till condition occurs, following:

... while not some_condition:     gevent.sleep(0.00000000000001) ... 

this approach cpu intensive. if change gevent.sleep(0.000000000001) gevent.sleep(0.1), cpu usage drops 1/10. time, in worst case scenario, code continue execution 0.1 seconds after some_condition occurs, not right after.

so, how can make greenlet pause execution until condition occurs?

using gevent.event.event solved problem: http://www.gevent.org/gevent.event.html


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -