threading.local _threading_local problems

Jd jd at nospam.com
Fri Sep 21 13:36:34 EDT 2007


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)

  Or is there anyway to notify the object when the thread for which it
set the local storage is going away ?

   This looks to me a bit like design shortcoming. or I have missed
something completely.

Thanks
/Jd




More information about the Python-list mailing list