473,382 Members | 1,533 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,382 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 2652
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:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.