这与另一个线程See lots of clr!CLRSemaphore::Wait in call stack有关,我们看到很多线程上下文是System.Runtime.Remoting.Contexts.Context,我们不知道为什么会这样。如何使用上下文System.Runtime.Remoting.Contexts.Context来模拟一个线程?
0:030> !do 0000001fc0afc158
Name: System.Threading.Thread
MethodTable: 00007fffcd232140
EEClass: 00007fffccc6fa48
Size: 96(0x60) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
Fields:
MT Field Offset Type VT Attr Value Name
00007fffcd2ae6c8 4000765 8 ....Contexts.Context 0 instance 0000001fc0a80fe8 m_Context
00007fffcd248d40 4000766 10 ....ExecutionContext 0 instance 0000001cc0dcfc40 m_ExecutionContext
00007fffcd230bd8 4000767 18 System.String 0 instance 0000000000000000 m_Name
00007fffcd2332f0 4000768 20 System.Delegate 0 instance 0000000000000000 m_Delegate
00007fffcd2351d8 4000769 28 ...ation.CultureInfo 0 instance 0000000000000000 m_CurrentCulture
00007fffcd2351d8 400076a 30 ...ation.CultureInfo 0 instance 0000000000000000 m_CurrentUICulture
00007fffcd2311b8 400076b 38 System.Object 0 instance 0000000000000000 m_ThreadStartArg
00007fffcd234848 400076c 40 System.IntPtr 1 instance 208de67840 DONT_USE_InternalThread
00007fffcd2337c8 400076d 48 System.Int32 1 instance 2 m_Priority
00007fffcd2337c8 400076e 4c System.Int32 1 instance 12 m_ManagedThreadId
00007fffcd22f370 400076f 50 System.Boolean 1 instance 0 m_ExecutionContextBelongsToOuterScope
00007fffcd23b9e0 4000770 378 ...LocalDataStoreMgr 0 shared static s_LocalDataStoreMgr
>> Domain:Value 0000001c3feb9a20:NotInit 000000208b6e4730:NotInit <<
00007fffcd23bbf0 4000771 8 ...alDataStoreHolder 0 shared TLstatic s_LocalDataStore
>> Thread:Value <<
0:030> !do 0000001fc0a80fe8
Name: System.Runtime.Remoting.Contexts.Context
MethodTable: 00007fffcd2ae6c8
EEClass: 00007fffccd74ad8
Size: 104(0x68) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll