Classes | |
class | _State |
class | ExceptionStackContext |
class | NullContext |
class | StackContext |
class | StackContextInconsistentError |
Functions | |
def | _handle_exception |
def | _remove_deactivated |
def | run_with_stack_context |
def | wrap |
Variables | |
tuple | _state = _State() |
def tornado.stack_context._handle_exception | ( | tail, | |
exc | |||
) | [private] |
Definition at line 352 of file stack_context.py.
def tornado.stack_context._remove_deactivated | ( | contexts | ) | [private] |
Remove deactivated handlers from the chain
Definition at line 227 of file stack_context.py.
def tornado.stack_context.run_with_stack_context | ( | context, | |
func | |||
) |
Run a coroutine ``func`` in the given `StackContext`. It is not safe to have a ``yield`` statement within a ``with StackContext`` block, so it is difficult to use stack context with `.gen.coroutine`. This helper function runs the function in the correct context while keeping the ``yield`` and ``with`` statements syntactically separate. Example:: @gen.coroutine def incorrect(): with StackContext(ctx): # ERROR: this will raise StackContextInconsistentError yield other_coroutine() @gen.coroutine def correct(): yield run_with_stack_context(StackContext(ctx), other_coroutine) .. versionadded:: 3.1
Definition at line 365 of file stack_context.py.
def tornado.stack_context.wrap | ( | fn | ) |
Returns a callable object that will restore the current `StackContext` when executed. Use this whenever saving a callback to be executed later in a different execution context (either in a different thread or asynchronously in the same thread).
Definition at line 253 of file stack_context.py.
tuple tornado::stack_context::_state = _State() |
Definition at line 85 of file stack_context.py.