[Web-SIG] Alternative to threading.local, based on the stack
Donovan Preston
dsposx at mac.com
Tue Jul 8 21:34:44 CEST 2008
On Jul 8, 2008, at 11:45 AM, Manlio Perillo wrote:
> Using greenlets, there is always a current greenlet, so you can use
> this for local storage.
>
> A library function can check if there is an active greenlet, and use
> it as data key; otherwise it will use the current thread id.
Yes, this is exactly what I did in the
wrap_threading_local_with_coro_local here:
http://donovanpreston.com:8888/eventlet/file/b6f9627e88df/eventlet/util.py
> However this will not work if you have an asynchronous server that
> does not make use of greenlets.
Exactly, which is why I am proposing just standardizing something that
does exactly what people use threading.local for, but whose
implementation is pluggable by the wsgi server.
Donovan
More information about the Web-SIG
mailing list