En Fri, 21 Sep 2007 14:36:34 -0300, Jd <[EMAIL PROTECTED]> escribi�:
> Hi > I have the following situation.. Have a worker thread, that does the > "work" given to it. While doing work, some of the objects use thread > local storage for storing that requires explicit close. e.g. connection > handles. These objects are long living. The worker, does not have any > direct access to the objects. > > I would like to clean up thread local area explicitly so that I do not > run out of connection handles. Any ideas on how to access local storage > from the thread ? (threading.local() gives new object everytime.. I am > looking for something like singleton / global access from within the > thread) Create a local() object *once*; it may be a global variable. Then assign to its attributes from any thread. Each thread will see a different set of attributes. > Or is there anyway to notify the object when the thread for which it > set the local storage is going away ? Do that at the end of the thread's run method. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list