Coming from the world of unix, I'm looking for a C#
fucntion that does as the unix thr_self() function does.
For those of you who arent familiar with that function, I
basically need a method of letting a child thread obtain
a unique thread id.
I simply want to print a message to the console and i'd
like the message to contain a unique id for each thread
so I can tell which thread is doing what.
Any way to do this?
I've seen the thread name property, but how does the
child thread know which one is his. assuming there are
more than 2-3 threads?
Help please. (remember, simple is the operative word
here.)
Thanks for your time.
Jaan - 07 Oct 2003 00:46 GMT
Nevermind, I found it.
System.Threading.Thread.CurrentThread.Name
In the parent thread, you just name your threads and in
the child threads, you look at the property:
System.Threading.Thread.CurrentThread.Name
>-----Original Message-----
>Coming from the world of unix, I'm looking for a C#
[quoted text clipped - 18 lines]
>
>.
Lloyd Dupont - 07 Oct 2003 01:33 GMT
I suspect
System.Threading.Thread.CurrentThread.GetHashCode() would be even better for
you !
> Nevermind, I found it.
> System.Threading.Thread.CurrentThread.Name
[quoted text clipped - 26 lines]
> >
> >.