xotl.tools.context
- Simple execution contexts¶
Note
About thread-locals and contexts.
The context
uses internally a thread-local
instance to keep context stacks in different
threads from seeing each other.
If, when this module is imported, greenlet
is imported already,
greenlet isolation is also warranted (which implies thread isolation).
If you use collaborative multi-tasking based in other framework other than greenlet, you must ensure to monkey patch the threading.local class so that isolation is kept.
In future releases of xotl.tools, we plan to provide a way to inject a “process” identity manager so that other frameworks be easily integrated.
Changed in version 1.7.1: Changed the test about greenlet
. Instead of
testing for greenlet to be importable, test it is imported already.
Changed in version 1.6.9: Added direct greenlet isolation and removed the
need for gevent.local
.
New in version 1.6.8: Uses gevent.local
if available to isolate
greenlets.