15 [ComDefaultInterface(typeof(
_Thread))]
17 [__DynamicallyInvokable]
24 private string m_Name;
32 private object m_ThreadStartArg;
34 private IntPtr DONT_USE_InternalThread;
36 private int m_Priority;
38 private int m_ManagedThreadId;
40 private bool m_ExecutionContextBelongsToOuterScope;
42 private static LocalDataStoreMgr s_LocalDataStoreMgr;
45 private static LocalDataStoreHolder s_LocalDataStore;
53 [__DynamicallyInvokable]
57 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
58 [SecuritySafeCritical]
59 [__DynamicallyInvokable]
63 internal bool ExecutionContextBelongsToCurrentScope
67 return !m_ExecutionContextBelongsToOuterScope;
71 m_ExecutionContextBelongsToOuterScope = !value;
79 [SecuritySafeCritical]
80 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
85 return GetMutableExecutionContext();
87 return m_ExecutionContext;
97 [SecuritySafeCritical]
102 [SecuritySafeCritical]
106 SetPriorityNative((
int)value);
116 [SecuritySafeCritical]
126 [SecuritySafeCritical]
132 [__DynamicallyInvokable]
135 [SecuritySafeCritical]
136 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
137 [__DynamicallyInvokable]
140 return GetCurrentThreadNative();
150 [SecuritySafeCritical]
153 return IsBackgroundNative();
155 [SecuritySafeCritical]
159 SetBackgroundNative(value);
167 [SecuritySafeCritical]
177 [Obsolete(
"The ApartmentState property has been deprecated. Use GetApartmentState, SetApartmentState or TrySetApartmentState instead.",
false)]
180 [SecuritySafeCritical]
185 [SecuritySafeCritical]
189 SetApartmentStateNative((
int)value, fireMDAOnMismatch:
true);
197 [__DynamicallyInvokable]
200 [__DynamicallyInvokable]
205 return CultureInfo.GetCultureInfoForUserPreferredLanguageInAppX() ?? GetCurrentUICultureNoAppX();
207 return GetCurrentUICultureNoAppX();
209 [SecuritySafeCritical]
210 [__DynamicallyInvokable]
218 CultureInfo.VerifyCultureName(value, throwException:
true);
219 if (!nativeSetThreadUILocale(value.SortName))
223 value.StartCrossDomainTracking();
224 if (!AppContextSwitches.NoAsyncCurrentCulture)
226 if (s_asyncLocalCurrentUICulture ==
null)
230 s_asyncLocalCurrentUICulture.
Value = value;
234 m_CurrentUICulture = value;
243 [__DynamicallyInvokable]
246 [__DynamicallyInvokable]
251 return CultureInfo.GetCultureInfoForUserPreferredLanguageInAppX() ?? GetCurrentCultureNoAppX();
253 return GetCurrentCultureNoAppX();
255 [SecuritySafeCritical]
256 [__DynamicallyInvokable]
265 value.StartCrossDomainTracking();
266 if (!AppContextSwitches.NoAsyncCurrentCulture)
268 if (s_asyncLocalCurrentCulture ==
null)
272 s_asyncLocalCurrentCulture.
Value = value;
276 m_CurrentCulture = value;
298 [SecuritySafeCritical]
304 if (principal ==
null)
311 [SecuritySafeCritical]
328 [SecuritySafeCritical]
339 InformThreadNameChange(GetNativeHandle(), value, value?.Length ?? 0);
344 internal object AbortReason
352 return GetAbortReason();
362 SetAbortReason(value);
366 private static LocalDataStoreMgr LocalDataStoreManager
370 if (s_LocalDataStoreMgr ==
null)
372 Interlocked.CompareExchange(ref s_LocalDataStoreMgr,
new LocalDataStoreMgr(),
null);
374 return s_LocalDataStoreMgr;
378 private static void AsyncLocalSetCurrentCulture(AsyncLocalValueChangedArgs<CultureInfo> args)
383 private static void AsyncLocalSetCurrentUICulture(AsyncLocalValueChangedArgs<CultureInfo> args)
391 [SecuritySafeCritical]
398 SetStartHelper(start, 0);
408 [SecuritySafeCritical]
415 if (0 > maxStackSize)
419 SetStartHelper(start, maxStackSize);
426 [SecuritySafeCritical]
433 SetStartHelper(start, 0);
443 [SecuritySafeCritical]
450 if (0 > maxStackSize)
454 SetStartHelper(start, maxStackSize);
462 return m_ManagedThreadId;
465 internal ThreadHandle GetNativeHandle()
467 IntPtr dONT_USE_InternalThread = DONT_USE_InternalThread;
468 if (dONT_USE_InternalThread.IsNull())
472 return new ThreadHandle(dONT_USE_InternalThread);
479 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
482 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
483 Start(ref stackMark);
492 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
499 m_ThreadStartArg = parameter;
500 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
501 Start(ref stackMark);
504 [SecuritySafeCritical]
505 private void Start(ref StackCrawlMark stackMark)
507 StartupSetApartmentStateInternal();
508 if ((
object)m_Delegate !=
null)
510 ThreadHelper threadHelper = (ThreadHelper)m_Delegate.
Target;
512 threadHelper.SetExecutionContextHelper(executionContextHelper);
515 StartInternal(principal, ref stackMark);
518 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
525 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
528 if (m_ExecutionContext ==
null)
532 else if (!ExecutionContextBelongsToCurrentScope)
534 ExecutionContext executionContext = m_ExecutionContext = m_ExecutionContext.CreateMutableCopy();
536 ExecutionContextBelongsToCurrentScope =
true;
537 return m_ExecutionContext;
541 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
542 internal void SetExecutionContext(
ExecutionContext value,
bool belongsToCurrentScope)
544 m_ExecutionContext = value;
545 ExecutionContextBelongsToCurrentScope = belongsToCurrentScope;
549 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
552 m_ExecutionContext = value.DangerousGetRawExecutionContext();
553 ExecutionContextBelongsToCurrentScope = belongsToCurrentScope;
558 private extern void StartInternal(
IPrincipal principal, ref StackCrawlMark stackMark);
564 [Obsolete(
"Thread.SetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")]
572 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
573 internal extern IntPtr SetAppDomainStack(SafeCompressedStackHandle csHandle);
577 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
578 internal extern void RestoreAppDomainStack(
IntPtr appDomainStack);
585 [Obsolete(
"Thread.GetCompressedStack is no longer supported. Please use the System.Threading.CompressedStack class")]
593 internal static extern IntPtr InternalGetCurrentThread();
599 [SecuritySafeCritical]
603 AbortReason = stateInfo;
610 [SecuritySafeCritical]
619 private extern void AbortInternal();
625 [SecuritySafeCritical]
634 currentThread.ResetAbortNative();
635 currentThread.ClearAbortReason();
640 private extern void ResetAbortNative();
645 [SecuritySafeCritical]
646 [Obsolete(
"Thread.Suspend has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202",
false)]
656 private extern void SuspendInternal();
661 [SecuritySafeCritical]
662 [Obsolete(
"Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202",
false)]
671 private extern void ResumeInternal();
675 [SecuritySafeCritical]
684 private extern void InterruptInternal();
688 private extern int GetPriorityNative();
692 private extern void SetPriorityNative(
int priority);
696 private extern bool JoinInternal(
int millisecondsTimeout);
701 [SecuritySafeCritical]
702 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
714 [SecuritySafeCritical]
715 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
716 public bool Join(
int millisecondsTimeout)
718 return JoinInternal(millisecondsTimeout);
727 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
731 if (num < -1 || num >
int.MaxValue)
735 return Join((
int)num);
740 private static extern void SleepInternal(
int millisecondsTimeout);
745 [SecuritySafeCritical]
746 public static void Sleep(
int millisecondsTimeout)
748 SleepInternal(millisecondsTimeout);
749 if (AppDomainPauseManager.IsPaused)
751 AppDomainPauseManager.ResumeEvent.WaitOneWithoutFAS();
761 if (num < -1 || num >
int.MaxValue)
770 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
771 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
772 private static extern void SpinWaitInternal(
int iterations);
776 [SecuritySafeCritical]
777 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
778 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
781 SpinWaitInternal(iterations);
786 [SuppressUnmanagedCodeSecurity]
787 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
788 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
789 private static extern bool YieldInternal();
794 [SecuritySafeCritical]
795 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
796 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
799 return YieldInternal();
804 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
805 private static extern Thread GetCurrentThreadNative();
808 private void SetStartHelper(
Delegate start,
int maxStackSize)
810 ulong processDefaultStackSize = GetProcessDefaultStackSize();
811 if ((uint)maxStackSize > processDefaultStackSize)
819 maxStackSize = (int)
Math.
Min(processDefaultStackSize, 2147483647uL);
822 ThreadHelper @
object =
new ThreadHelper(start);
835 [SuppressUnmanagedCodeSecurity]
836 private static extern ulong GetProcessDefaultStackSize();
840 private extern void SetStart(Delegate start,
int maxStackSize);
843 [SecuritySafeCritical]
844 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
852 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
853 private extern void InternalFinalize();
858 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
863 private extern bool IsBackgroundNative();
867 private extern void SetBackgroundNative(
bool isBackground);
871 private extern int GetThreadStateNative();
875 [SecuritySafeCritical]
888 [SecuritySafeCritical]
889 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, SelfAffectingThreading =
true)]
892 return SetApartmentStateHelper(state, fireMDAOnMismatch:
false);
901 [SecuritySafeCritical]
902 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, SelfAffectingThreading =
true)]
905 if (!SetApartmentStateHelper(state, fireMDAOnMismatch:
true))
912 private bool SetApartmentStateHelper(
ApartmentState state,
bool fireMDAOnMismatch)
919 if (apartmentState != state)
928 private extern int GetApartmentStateNative();
932 private extern int SetApartmentStateNative(
int state,
bool fireMDAOnMismatch);
936 private extern void StartupSetApartmentStateInternal();
940 [HostProtection(
SecurityAction.LinkDemand, SharedState =
true, ExternalThreading =
true)]
943 return LocalDataStoreManager.AllocateDataSlot();
950 [HostProtection(
SecurityAction.LinkDemand, SharedState =
true, ExternalThreading =
true)]
953 return LocalDataStoreManager.AllocateNamedDataSlot(name);
959 [HostProtection(
SecurityAction.LinkDemand, SharedState =
true, ExternalThreading =
true)]
962 return LocalDataStoreManager.GetNamedDataSlot(name);
967 [HostProtection(
SecurityAction.LinkDemand, SharedState =
true, ExternalThreading =
true)]
970 LocalDataStoreManager.FreeNamedDataSlot(name);
976 [HostProtection(
SecurityAction.LinkDemand, SharedState =
true, ExternalThreading =
true)]
979 LocalDataStoreHolder localDataStoreHolder = s_LocalDataStore;
980 if (localDataStoreHolder ==
null)
982 LocalDataStoreManager.ValidateSlot(slot);
985 return localDataStoreHolder.Store.GetData(slot);
991 [HostProtection(
SecurityAction.LinkDemand, SharedState =
true, ExternalThreading =
true)]
994 LocalDataStoreHolder localDataStoreHolder = s_LocalDataStore;
995 if (localDataStoreHolder ==
null)
997 localDataStoreHolder = (s_LocalDataStore = LocalDataStoreManager.CreateLocalDataStore());
999 localDataStoreHolder.Store.SetData(slot, data);
1004 private static extern bool nativeGetSafeCulture(
Thread t,
int appDomainId,
bool isUI, ref
CultureInfo safeCulture);
1006 [SecuritySafeCritical]
1009 if (m_CurrentUICulture ==
null)
1012 if (defaultThreadCurrentUICulture ==
null)
1016 return defaultThreadCurrentUICulture;
1019 if (!nativeGetSafeCulture(
this,
GetDomainID(), isUI:
true, ref safeCulture) || safeCulture ==
null)
1028 private static extern bool nativeSetThreadUILocale(
string locale);
1030 [SecuritySafeCritical]
1033 if (m_CurrentCulture ==
null)
1036 if (defaultThreadCurrentCulture ==
null)
1040 return defaultThreadCurrentCulture;
1043 if (!nativeGetSafeCulture(
this,
GetDomainID(), isUI:
false, ref safeCulture) || safeCulture ==
null)
1051 internal Context GetCurrentContextInternal()
1053 if (m_Context ==
null)
1061 private void SetPrincipalInternal(
IPrincipal principal)
1063 GetMutableExecutionContext().LogicalCallContext.SecurityData.Principal = principal;
1068 internal static extern Context GetContextInternal(IntPtr
id);
1072 internal extern object InternalCrossContextCallback(
Context ctx, IntPtr ctxID,
int appDomainID, InternalCrossContextDelegate ftnToCall,
object[] args);
1075 internal object InternalCrossContextCallback(
Context ctx, InternalCrossContextDelegate ftnToCall,
object[] args)
1077 return InternalCrossContextCallback(ctx, ctx.InternalContextID, 0, ftnToCall, args);
1080 private static object CompleteCrossContextCallback(InternalCrossContextDelegate ftnToCall,
object[] args)
1082 return ftnToCall(args);
1087 private static extern AppDomain GetDomainInternal();
1091 private static extern AppDomain GetFastDomainInternal();
1095 [SecuritySafeCritical]
1098 AppDomain appDomain = GetFastDomainInternal();
1099 if (appDomain ==
null)
1101 appDomain = GetDomainInternal();
1115 [SuppressUnmanagedCodeSecurity]
1116 private static extern void InformThreadNameChange(ThreadHandle t,
string name,
int len);
1120 [SecuritySafeCritical]
1121 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
1122 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
1127 [SecuritySafeCritical]
1128 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
1129 [HostProtection(
SecurityAction.LinkDemand, Synchronization =
true, ExternalThreading =
true)]
1136 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
1143 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
1152 byte result = address;
1163 short result = address;
1174 int result = address;
1185 long result = address;
1194 [CLSCompliant(
false)]
1197 sbyte result = address;
1206 [CLSCompliant(
false)]
1209 ushort result = address;
1218 [CLSCompliant(
false)]
1221 uint result = address;
1241 [CLSCompliant(
false)]
1253 [CLSCompliant(
false)]
1256 ulong result = address;
1267 float result = address;
1278 double result = address;
1289 object result = address;
1338 [CLSCompliant(
false)]
1349 [CLSCompliant(
false)]
1360 [CLSCompliant(
false)]
1381 [CLSCompliant(
false)]
1392 [CLSCompliant(
false)]
1431 [SecuritySafeCritical]
1432 [__DynamicallyInvokable]
1460 void _Thread.
GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
1462 throw new NotImplementedException();
1475 void _Thread.
Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid,
short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
1477 throw new NotImplementedException();
1482 internal extern void SetAbortReason(
object o);
1486 internal extern object GetAbortReason();
1490 internal extern void ClearAbortReason();
static Thread CurrentThread
Gets the currently running thread.
bool IsBackground
Gets or sets a value indicating whether or not a thread is a background thread.
static IPrincipal CurrentPrincipal
Gets or sets the thread's current principal (for role-based security).
A platform-specific type that is used to represent a pointer or a handle.
bool IsThreadPoolThread
Gets a value indicating whether or not a thread belongs to the managed thread pool.
static void VolatileWrite(ref byte address, byte value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
void DisableComObjectEagerCleanup()
Turns off automatic cleanup of runtime callable wrappers (RCW) for the current thread.
static CultureInfo DefaultThreadCurrentUICulture
Gets or sets the default UI culture for threads in the current application domain.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Describes a set of security permissions applied to code. This class cannot be inherited.
delegate void ParameterizedThreadStart(object obj)
Represents the method that executes on a T:System.Threading.Thread.
ThreadPriority
Specifies the scheduling priority of a T:System.Threading.Thread.
bool Join(TimeSpan timeout)
Blocks the calling thread until the thread represented by this instance terminates or the specified t...
Ability to use certain advanced operations on threads.
static void MemoryBarrier()
Synchronizes memory access as follows: The processor executing the current thread cannot reorder inst...
Encapsulates a memory slot to store local data. This class cannot be inherited.
static Context DefaultContext
Gets the default context for the current application domain.
Defines the basic functionality of a principal object.
static int VolatileRead(ref int address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
CompressedStack GetCompressedStack()
Returns a T:System.Threading.CompressedStack object that can be used to capture the stack for the cur...
bool TrySetApartmentState(ApartmentState state)
Sets the apartment state of a thread before it is started.
The exception that is thrown when a T:System.Threading.Thread is in an invalid P:System....
Ensures that all finalization code in derived classes is marked as critical.
static LocalDataStoreSlot GetNamedDataSlot(string name)
Looks up a named data slot. For better performance, use fields that are marked with the T:System....
static sbyte Min(sbyte val1, sbyte val2)
Returns the smaller of two 8-bit signed integers.
ThreadState ThreadState
Gets a value containing the states of the current thread.
static double VolatileRead(ref double address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
delegate void ThreadStart()
Represents the method that executes on a T:System.Threading.Thread.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
static void Sleep(TimeSpan timeout)
Suspends the current thread for the specified amount of time.
static float VolatileRead(ref float address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
void Join()
Blocks the calling thread until the thread represented by this instance terminates,...
double TotalMilliseconds
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional milliseco...
object Target
Gets the class instance on which the current delegate invokes the instance method.
void GetTypeInfoCount(out uint pcTInfo)
Retrieves the number of type information interfaces that an object provides (either 0 or 1).
static IntPtr VolatileRead(ref IntPtr address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
Defines an environment for the objects that are resident inside it and for which a policy can be enfo...
Exposes the T:System.Threading.Thread class to unmanaged code.
static ulong VolatileRead(ref ulong address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
void Resume()
Resumes a thread that has been suspended.
static CultureInfo DefaultThreadCurrentCulture
Gets or sets the default culture for threads in the current application domain.
Represents an application domain, which is an isolated environment where applications execute....
void SetCompressedStack(CompressedStack stack)
Applies a captured T:System.Threading.CompressedStack to the current thread.
Cer
Specifies a method's behavior when called within a constrained execution region.
Thread(ThreadStart start, int maxStackSize)
Initializes a new instance of the T:System.Threading.Thread class, specifying the maximum stack size ...
static LocalDataStoreSlot AllocateDataSlot()
Allocates an unnamed data slot on all the threads. For better performance, use fields that are marked...
static short VolatileRead(ref short address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
static byte VolatileRead(ref byte address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
override int GetHashCode()
Returns a hash code for the current thread.
SecurityAction
Specifies the security actions that can be performed using declarative security.
CultureInfo?? CurrentCulture
Gets or sets the culture for the current thread.
Provides information about, and means to manipulate, the current environment and platform....
Manages the execution context for the current thread. This class cannot be inherited.
static void VolatileWrite(ref IntPtr address, IntPtr value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
static void ResetAbort()
Cancels an M:System.Threading.Thread.Abort(System.Object) requested for the current thread.
ApartmentState GetApartmentState()
Returns an T:System.Threading.ApartmentState value indicating the apartment state.
Finds or creates a T:System.AppDomain.
ApartmentState ApartmentState
Gets or sets the apartment state of this thread.
static int CompareExchange(ref int location1, int value, int comparand)
Compares two 32-bit signed integers for equality and, if they are equal, replaces the first value.
Provides a set of properties that are carried with the execution code path. This class cannot be inhe...
static void BeginCriticalRegion()
Notifies a host that execution is about to enter a region of code in which the effects of a thread ab...
Defines the underlying structure of all code access permissions.
A platform-specific type that is used to represent a pointer or a handle.
void Abort()
Raises a T:System.Threading.ThreadAbortException in the thread on which it is invoked,...
static object VolatileRead(ref object address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
Maps a set of names to a corresponding set of dispatch identifiers.
Represents a delegate, which is a data structure that refers to a static method or to a class instanc...
static ushort VolatileRead(ref ushort address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
Thread(ThreadStart start)
Initializes a new instance of the T:System.Threading.Thread class.
bool IsAlive
Gets a value indicating the execution status of the current thread.
void Start(object parameter)
Causes the operating system to change the state of the current instance to F:System....
static void VolatileWrite(ref long address, long value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
void SetApartmentState(ApartmentState state)
Sets the apartment state of a thread before it is started.
MethodImplOptions
Defines the details of how a method is implemented.
static AppDomain GetDomain()
Returns the current domain in which the current thread is running.
static void VolatileWrite(ref UIntPtr address, UIntPtr value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
Manipulates threads in a way that only affects user code.
static void BeginThreadAffinity()
Notifies a host that managed code is about to execute instructions that depend on the identity of the...
CharSet
Dictates which character set marshaled strings should use.
static void EndCriticalRegion()
Notifies a host that execution is about to enter a region of code in which the effects of a thread ab...
T Value
Gets or sets the value of the ambient data.
void Start()
Causes the operating system to change the state of the current instance to F:System....
void Abort(object stateInfo)
Raises a T:System.Threading.ThreadAbortException in the thread on which it is invoked,...
ThreadPriority Priority
Gets or sets a value indicating the scheduling priority of a thread.
static ExecutionContext Capture()
Captures the execution context from the current thread.
static void VolatileWrite(ref int address, int value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
The exception that is thrown when one of the arguments provided to a method is not valid.
void Demand()
Forces a T:System.Security.SecurityException at run time if all callers higher in the call stack have...
static sbyte VolatileRead(ref sbyte address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
static void VolatileWrite(ref object address, object value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
Retrieves the type information for an object, which can be used to get the type information for an in...
static void VolatileWrite(ref sbyte address, sbyte value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
static void VolatileWrite(ref ulong address, ulong value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
static void VolatileWrite(ref uint address, uint value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
int ManagedThreadId
Gets a unique identifier for the current managed thread.
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
static void VolatileWrite(ref ushort address, ushort value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
bool Join(int millisecondsTimeout)
Blocks the calling thread until the thread represented by this instance terminates or the specified t...
static LocalDataStoreSlot AllocateNamedDataSlot(string name)
Allocates a named data slot on all threads. For better performance, use fields that are marked with t...
Creates or manipulates threads other than its own, which might be harmful to the host.
void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
Provides access to properties and methods exposed by an object.
static UIntPtr VolatileRead(ref UIntPtr address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
Provides methods for setting and capturing the compressed stack on the current thread....
Thread(ParameterizedThreadStart start, int maxStackSize)
Initializes a new instance of the T:System.Threading.Thread class, specifying a delegate that allows ...
Represents a time interval.To browse the .NET Framework source code for this type,...
static void EndThreadAffinity()
Notifies a host that managed code has finished executing instructions that depend on the identity of ...
static void FreeNamedDataSlot(string name)
Eliminates the association between a name and a slot, for all threads in the process....
static void SetData(LocalDataStoreSlot slot, object data)
Sets the data in the specified slot on the currently running thread, for that thread's current domain...
static uint VolatileRead(ref uint address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
static void VolatileWrite(ref float address, float value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
The exception that is thrown when a method call is invalid for the object's current state.
ClassInterfaceType
Identifies the type of class interface that is generated for a class.
Consistency
Specifies a reliability contract.
void Interrupt()
Interrupts a thread that is in the WaitSleepJoin thread state.
Thread(ParameterizedThreadStart start)
Initializes a new instance of the T:System.Threading.Thread class, specifying a delegate that allows ...
static int GetDomainID()
Returns a unique application domain identifier.
Provides constants and static methods for trigonometric, logarithmic, and other common mathematical f...
Provides information about a specific culture (called a locale for unmanaged code development)....
static object GetData(LocalDataStoreSlot slot)
Retrieves the value from the specified slot on the current thread, within the current thread's curren...
string??? Name
Gets or sets the name of the thread.
SecurityPermissionFlag
Specifies access flags for the security permission object.
static void VolatileWrite(ref short address, short value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
static void Sleep(int millisecondsTimeout)
Suspends the current thread for the specified number of milliseconds.
ThreadState
Specifies the execution states of a T:System.Threading.Thread.
Provides atomic operations for variables that are shared by multiple threads.
static Context CurrentContext
Gets the current context in which the thread is executing.
The exception that is thrown when a requested method or operation is not implemented.
The exception that is thrown when a security error is detected.
ExecutionContext ExecutionContext
Gets an T:System.Threading.ExecutionContext object that contains information about the various contex...
ApartmentState
Specifies the apartment state of a T:System.Threading.Thread.
static long VolatileRead(ref long address)
Reads the value of a field. The value is the latest written by any processor in a computer,...
static bool Yield()
Causes the calling thread to yield execution to another thread that is ready to run on the current pr...
CultureInfo?? CurrentUICulture
Gets or sets the current culture used by the Resource Manager to look up culture-specific resources a...
static void VolatileWrite(ref double address, double value)
Writes a value to a field immediately, so that the value is visible to all processors in the computer...
void Suspend()
Either suspends the thread, or if the thread is already suspended, has no effect.
static void SpinWait(int iterations)
Causes a thread to wait the number of times defined by the iterations parameter.
Creates and controls a thread, sets its priority, and gets its status.