Threads are lightweight processes. One common example of use of thread is implementation of concurrent programming by modern operating systems.
The following are some of the properties of the Thread class −
|Sr.No.||Property & Description|
Gets the current context in which the thread is executing.
Gets or sets the culture for the current thread.
Gets or sets the thread's current principal (for role-based security).
Gets the currently running thread.
Gets or sets the current culture used by the Resource Manager to look up culture-specific resources at run-time.
Gets an ExecutionContext object that contains information about the various contexts of the current thread.
Gets a value indicating the execution status of the current thread.
Gets or sets a value indicating whether or not a thread is a background thread.
The following are the methods of the Thread class −
|Sr.No.||Method & Description|
|1||public void Abort()|
Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of terminating the thread. Calling this method usually terminates the thread.
|2||public static LocalDataStoreSlot AllocateDataSlot()|
Allocates an unnamed data slot on all the threads. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.
|3||public static LocalDataStoreSlot AllocateNamedDataSlot(string name)|
Allocates a named data slot on all threads. For better performance, use fields that are marked with the ThreadStaticAttribute attribute instead.
|4||public static void BeginCriticalRegion()|
Notifies a host that execution is about to enter a region of code in which the effects of a thread abort or unhandled exception might jeopardize other tasks in the application domain.
|5||public static void BeginThreadAffinity()|
Notifies a host that managed code is about to execute instructions that depend on the identity of the current physical operating system thread.
|6||public static void EndCriticalRegion()|
Notifies a host that execution is about to enter a region of code in which the effects of a thread abort or unhandled exception are limited to the current task.
|7||public static void EndThreadAffinity()|
Notifies a host that managed code has finished executing instructions that depend on the identity of the current physical operating system thread.