473,396 Members | 2,004 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.

Thread DataSlot

The Thread class exposes AllocateNamedDataSlot() and AllocateDataSlot()
methods which allow allocating memory for thread-specific data. How is
this different from encapsulating each running thread in a class and
using that class to store the data?

Bram Fokke
Utrecht, the Netherlands

Jun 12 '06 #1
3 2095
The difference is in the "thread specific data" ... By wrapping your
thread in class you do not have "thread specific data".

Regards,
Tasos

b.fo...@gmail.com wrote:
The Thread class exposes AllocateNamedDataSlot() and AllocateDataSlot()
methods which allow allocating memory for thread-specific data. How is
this different from encapsulating each running thread in a class and
using that class to store the data?

Bram Fokke
Utrecht, the Netherlands


Jun 12 '06 #2
Bram,

The members of a class can be accessed by any thread. Encapsulating a
running thread in a class doesn't prevent other threads from accessing
the members of that class. Of course you could provide a loose
enforcement by simply making sure you don't access that class from
another thread. Contrast that with thread local storage which strictly
enforces the coupling of data to a specific thread. There may be cases
where you want multiple threads executing code in the same class, but
have their own copy of data to work with.

Brian

b.*****@gmail.com wrote:
The Thread class exposes AllocateNamedDataSlot() and AllocateDataSlot()
methods which allow allocating memory for thread-specific data. How is
this different from encapsulating each running thread in a class and
using that class to store the data?

Bram Fokke
Utrecht, the Netherlands


Jun 12 '06 #3
Thanks for both answers!

Jun 12 '06 #4

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

Similar topics

14
by: adeger | last post by:
Having trouble with my first forays into threads. Basically, the threads don't seem to be working in parallel (or you might say are blocking). I've boiled my problems to the following short code...
4
by: Gilles Leblanc | last post by:
Hi I have started a small project with PyOpenGL. I am wondering what are the options for a GUI. So far I checked PyUI but it has some problems with 3d rendering outside the Windows platform. I...
7
by: Ivan | last post by:
Hi I have following problem: I'm creating two threads who are performing some tasks. When one thread finished I would like to restart her again (e.g. new job). Following example demonstrates...
4
by: Matthew Groch | last post by:
Hi all, I've got a server that handles a relatively high number of concurrent transactions (on the magnitude of 1000's per second). Client applications establish socket connections with the...
5
by: Razzie | last post by:
Hi all, A question from someone on a website got me thinking about this, and I wondered if anyone could explain this. A System.Threading.Timer object is garbage collected if it has no...
16
by: droopytoon | last post by:
Hi, I start a new thread (previous one was "thread timing") because I have isolated my problem. It has nothing to do with calling unmanaged C++ code (I removed it in a test application). I...
9
by: mareal | last post by:
I have noticed how the thread I created just stops running. I have added several exceptions to the thread System.Threading.SynchronizationLockException System.Threading.ThreadAbortException...
13
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
1
by: Aamir Mahmood | last post by:
Hi, Is is safe to use Thread.GetNamedDataSlot function inside a ASP.Net application? I am afraid if IIS manipulates the threads and my DataSlot is lost in that. Thanks. AM.
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.