Thread Data for Thread in pool

G

Guest

Hi,

I'm using thread from a .NET Thread pool. And I assign some data in the
thread during the time of its processing in Thread Local Storage. When the
process gets over and the thread goes back to the pool, what happens to the
data it contained. Is the data invalidated by the time the thread gets
assigned to a different process or does the data continue to persist? How
long the data persists, if at all it does?

Thanks and Regards,
Kishore
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


What you mean with "Data" ?

If you mean referenced instances they are collected by the GC in the same
way it does happen when running in the main thread.

Please explain further what you mean. maybe with an example

Cheers,
 
G

Guest

By "data" I mean any simple data like a string. When the thread is assigned
to another process, will that process be able to see the data stored by the
previous process..??

Thanks and Regards,
Kishore
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

The memory management does not change depending of the thread, the memory
will be collected when the GC runs and such a memory is not referenced.

Cheers,
 
R

Richard Blewett [DevelopMentor]

The thread does not get assigned to a different process, threads are bound to a process and live and die with it. The thread pool is process specific and when you finish with that thread it will go back to the pool. The pool manager may well kill the thread iat some point if there is no work for it to do. The state in the ThreadData will live as long as the thread does.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

I'm using thread from a .NET Thread pool. And I assign some data in the
thread during the time of its processing in Thread Local Storage. When the
process gets over and the thread goes back to the pool, what happens to the
data it contained. Is the data invalidated by the time the thread gets
assigned to a different process or does the data continue to persist? How
long the data persists, if at all it does?

Thanks and Regards,
Kishore
 
R

Richard Blewett [DevelopMentor]

Ah - so you're not talking about thread local storage here then, just resrouces allocated during the thread function's execution?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

By "data" I mean any simple data like a string. When the thread is assigned
to another process, will that process be able to see the data stored by the
previous process..??

Thanks and Regards,
Kishore
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top