#Some popular methods of Thread class are start, sleep, jon and abort. Let’s see the complete list of methods -
Mr. Number | Methods and instructions |
---|---|
1 |
public void Abort() Throws a ThreadAbortException in the thread that calls it to begin the process of terminating the thread. Calling this method usually terminates the thread. |
2 |
Public static LocalDataStoreSlot AllocateDataSlot() Allocate an unnamed data slot on all threads. For better performance, use fields marked with the ThreadStaticAttribute attribute instead. |
3 |
public static LocalDataStoreSlot AllocateNamedDataSlot(String name) Allocate a named data slot on all threads. For better performance, use fields marked with the ThreadStaticAttribute attribute instead. |
4 |
public static void BeginCriticalRegion() Notifies the host that execution is about to enter a code region where the effects of a thread abort or an unhandled exception may jeopardize other tasks in the application domain. |
5 |
public static void BeginThreadAffinity() Notifies the host managed code that instructions are about to be executed that depend on the current physical operating system thread identity. |
6 |
public static void EndCriticalRegion() Notify the host that execution is about to enter a code region where the impact of thread abort or unhandled exception is limited to the current task. |
7 |
public static void EndThreadAffinity() Notifies the host that managed code has finished executing instructions that depend on the current physical operating system thread identity. |
8 |
public static void FreeNamedDataSlot(string name) Eliminate the association between the names and slots of all threads in the process. For better performance, use fields marked with the ThreadStaticAttribute attribute instead. |
9 |
Public static object GetData(LocalDataStoreSlot slot) Retrieves the value from the specified slot on the current thread within the current scope of the current thread. For better performance, use fields marked with the ThreadStaticAttribute attribute instead. |
10 |
Public static AppDomain GetDomain() Return the current domain where the current thread is running. |
11 |
Public static AppDomain GetDomainID() Return unique application domain identifier |
12 |
public static LocalDataStoreSlot GetNamedDataSlot(string name) Find the specified data slot. For better performance, use fields marked with the ThreadStaticAttribute attribute instead. |
13 |
public void Interrupt() Interrupt the thread in WaitSleepJoin thread state. |
14 |
public void Join() Blocks the calling thread until the thread terminates, while continuing standard COM and SendMessage pumping. This method has different overloaded forms. |
15 |
public static void MemoryBarrier() Synchronize memory accesses as follows - The processor executing the current thread cannot reorder instructions in such a way that memory accesses before calling MemoryBarrier are executed after memory accesses after calling MemoryBarrier. |
16 |
public static void ResetAbort() Cancel the suspension of the current thread request. |
17 |
public static void SetData(LocalDataStoreSlot slot, object data) Set the data in the specified slot for the current domain of the currently running thread. For better performance, use fields marked with the ThreadStaticAttribute attribute instead. |
18 |
public void Start() Start a thread. |
19 |
public static void Sleep(int millisecondsTimeout) Pause the thread for a period of time. |
20 |
public static void SpinWait(int iterations) Make the thread wait for the number of times defined by the iteration parameter |
The above is the detailed content of Thread class methods. For more information, please follow other related articles on the PHP Chinese website!