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
Post a Comment