Package coro :: Module optional
[hide private]
[frames] | no frames]

Module optional

source code

Functions that can run in or out of coro.

This module provides emulation for some functions to run whether or not the coro event loop is running.


Version: $Revision: #3 $

Classes [hide private]
  _shutdown_sigalrm_exc
Functions [hide private]
 
_shutdown_sigalrm_handler(unused_signum, unused_frame) source code
 
with_timeout(timeout, function, *args, **kwargs)
Call a function with a timeout.
source code
 
sleep_relative(delta)
Sleep for a period of time.
source code
Variables [hide private]
  __package__ = 'coro'
Function Details [hide private]

with_timeout(timeout, function, *args, **kwargs)

source code 

Call a function with a timeout.

This version supports running even if the coro event loop isn't running by using SIGALRM.

See coro._coro.sched.with_timeout for more detail.

Parameters:
  • timeout - : The number of seconds to wait before raising the timeout. May be a floating point number.
  • function - : The function to call.
Returns:
Returns the return value of the function.
Raises:

sleep_relative(delta)

source code 
Sleep for a period of time.
Parameters:
  • delta - : The number of seconds to sleep.