Thread specific singleton

Aahz aahz at pythoncraft.com
Sun Jun 11 21:01:41 EDT 2006


In article <448991d2$0$18298$4fafbaef at reader1.news.tin.it>,
Gabriele Farina  <g.farina at html.it> wrote:
>
>I'm tring to implement a Singleton object that should be specific for 
>every thread who create it, not global.
>I tried a solution that seems to work, but I have a very poor knowledge 
>of concurrent programming, so I'd like someone to help me find some 
>problems in my implementation.

Try using threading.local(), but you'll need 2.4 or later.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I saw `cout' being shifted "Hello world" times to the left and stopped
right there."  --Steve Gonedes



More information about the Python-list mailing list