Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How unique is ManagedThreadID?

Tags:

For ManagedThreadID, MSDN says:

Gets a unique identifier for the current managed thread.

In what context does "unique" apply?

Is this unique per process?
Per application domain?
Per machine?
Per .NET runtime? (if I have both MS.NET and Mono running)

like image 591
Jimmy Avatar asked Feb 08 '10 13:02

Jimmy


People also ask

Is ManagedThreadId unique?

A thread's ManagedThreadId property value serves to uniquely identify that thread within its process.

What can be used as a unique identifier of a thread?

The getid() method The getid() function from the Thread class is used to extract a unique thread ID. This unique identifier is assigned when we create a new thread in our program.

What is thread currentthread ManagedThreadId?

A Thread class is responsible for creating and managing a thread in multi-thread programming. It provides a property known as ManagedThreadId to check the unique identifier for the current managed thread.

What is managed thread?

Thread Provides reference documentation for the Thread class, which represents a managed thread, whether it came from unmanaged code or was created in a managed application. BackgroundWorker Provides a safe way to implement multithreading in conjunction with user-interface objects.


1 Answers

Thread ID is unique per process during a thread's lifecycle. After the thread terminates, its number can be reused.

like image 54
Dewfy Avatar answered Oct 09 '22 13:10

Dewfy