guv.hubs.switch
- facilities for cooperative yielding¶guv.hubs.switch.
gyield
(switch_back=True)[source]¶Yield to other greenlets
This is a cooperative yield which suspends the current greenlet and allows other greenlets to run by switching to the hub.
Parameters: | switch_back (bool) – automatically switch back to this greenlet on the next event loop cycle |
---|
guv.hubs.switch.
trampoline
(fd, evtype, timeout=None, timeout_exc=<class 'guv.timeout.Timeout'>)[source]¶Jump from the current greenlet to the hub and wait until the given file descriptor is ready for I/O, or the specified timeout elapses
If the specified timeout elapses before the socket is ready to read or write, timeout_exc
will be raised instead of trampoline()
returning normally.
When the specified file descriptor is ready for I/O, the hub internally calls the callback to switch back to the current (this) greenlet.
Conditions:
READ
or WRITE
(not possible to
watch for both simultaneously)Parameters: |
---|