"Robert Brewer" <[EMAIL PROTECTED]> wrote:
> "Somewhat alleviated" and somewhat worsened. I've had half a dozen
> conversations in the last year about sharing data between threads; in
> every case, I've had to work quite hard to convince the other person
> that threading.local is *not* magic pixie thread dust. Each time, they
> had come to the conclusion that if they had a global variable, they
> could just stick a reference to it into a threading.local object and
> instantly have safe, concurrent access to it.

*boggles* Perhaps there should be an entry in the documentation about
this.  Here is a proposed modification.

Despite desires and assumptions to the contrary, <b>threading.local is
not magic</b>. Placing references to global shared objects into
threading.local <b>will not make them magically threadsafe</b>.  Only by
using threadsafe shared objects (by design with Queue.Queue, or by
desire with lock.acquire()/release() placed around object accesses) will
you have the potential for doing safe things.

 - Josiah

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to