473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

threading.local _threading_local problems

Jd
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

Sep 21 '07 #1
1 2654
En Fri, 21 Sep 2007 14:36:34 -0300, Jd <jd@nospam.comescribi�:
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

Sep 22 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Varun | last post by:
Hi Friends, Department of Information Technology, Madras Institute of Technology, Anna University, India is conducting a technical symposium, Samhita. As a part of samhita, an Online Programming...
1
by: Steven T. Hatton | last post by:
I pinned this to my desktop a while back so I'd remember to look at it: http://people.redhat.com/drepper/tls.pdf I just started reading it and realized that there may be a reason to extend the...
18
by: Frank Rizzo | last post by:
Hello, I have a class with all static methods that is called by multiple threads. I was wondering what effect that has on the competing threads. Does Thread2 have to wait until Thread1 is done...
1
by: craigedmunds | last post by:
Was having a few problems with some threading issues following the microsoft support webcast Microsoft ASP.NET Threading. Spoke to Wade Mascia & managed to get clarification. Thought i'd share it...
1
by: bdoyle | last post by:
python-help@python.org] Hi Python Experts, I am developing a Python interface to an existing (multithreaded) c++ api. I have it working on several platforms (linux, solaris, irix, windoze)...
1
by: usenet | last post by:
I'm having some problems getting the logging module to work with the threading module. I've narrowed the problem down to the following code: import logging, threading update_log =...
0
by: juxstapose | last post by:
Hello, I have been develop a blocking socket application with threading. The main thread handles connections and inserts them into python's protected queue as jobs for the thread pool to handle....
7
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has...
126
by: Dann Corbit | last post by:
Rather than create a new way of doing things: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html why not just pick up ACE into the existing standard:...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.