thread var

  • Thread starter Thread starter Thierry
  • Start date Start date
T

Thierry

Hello.

I am creating a class where the unique instance is called by many other
thread.
My class don't know how is structured the threads and of course I can't
modify threads code.

I want to create a var specific to each calling thread to store state
information on my class.
I want ,for example , count the number of call in a function for each thread
or detect recursive call
without having to pass parameters.

I am sure it's possible to do it , but how ???

Thanks

Thierry
 
Thierry said:
I am creating a class where the unique instance is called by many other
thread.
My class don't know how is structured the threads and of course I can't
modify threads code.

I want to create a var specific to each calling thread to store state
information on my class.
I want ,for example , count the number of call in a function for each thread
or detect recursive call
without having to pass parameters.

I am sure it's possible to do it , but how ???

It sounds like you're after the ThreadStaticAttribute - have a look at
the documentation for it.
 
Try the TLS attribute eg:

[ThreadStatic]
private static string TLSstrExtraInfo;

José
 
Back
Top