Skip to content

Instantly share code, notes, and snippets.

@jimjh
Last active November 26, 2018 22:25
Show Gist options
  • Save jimjh/140e844300637274833f4323d0a6b529 to your computer and use it in GitHub Desktop.
Save jimjh/140e844300637274833f4323d0a6b529 to your computer and use it in GitHub Desktop.
$ python late_patch.py
sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating point number for subsecond precision.
$ python eager_patch.py
Put the current greenlet to sleep for at least *seconds*.
*seconds* may be specified as an integer, or a float if fractional
seconds are desired.
.. tip:: In the current implementation, a value of 0 (the default)
means to yield execution to any other runnable greenlets, but
this greenlet may be scheduled again before the event loop
cycles (in an extreme case, a greenlet that repeatedly sleeps
with 0 can prevent greenlets that are ready to do I/O from
being scheduled for some (small) period of time); a value greater than
0, on the other hand, will delay running this greenlet until
the next iteration of the loop.
If *ref* is False, the greenlet running ``sleep()`` will not prevent :func:`gevent.wait`
from exiting.
.. seealso:: :func:`idle`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment