Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / October 2003

Tip: Looking for answers? Try searching our database.

C# and thread id

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jaan - 07 Oct 2003 00:28 GMT
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]
> >
> >.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.