@@ -3331,11 +3331,16 @@ void ThreadSuspend::SuspendRuntime(ThreadSuspend::SUSPEND_REASON reason)
3331
3331
STRESS_LOG3 (LF_SYNC, LL_INFO10000, " Inspecting thread 0x%x ID 0x%x coop mode = %d\n " ,
3332
3332
thread, thread->GetThreadId (), thread->m_fPreemptiveGCDisabled .LoadWithoutBarrier ());
3333
3333
3334
+
3334
3335
// ::FlushProcessWriteBuffers above guarantees that the state that we see here
3335
3336
// is after the trap flag is visible to the other thread.
3336
3337
//
3337
3338
// In other words: any threads seen in preemptive mode are no longer interesting to us.
3338
3339
// if they try switch to cooperative, they would see the flag set.
3340
+ #ifdef FEATURE_PERFTRACING
3341
+ // Mark that the thread is currently in managed code.
3342
+ thread->SaveGCModeOnSuspension ();
3343
+ #endif // FEATURE_PERFTRACING
3339
3344
if (!thread->m_fPreemptiveGCDisabled .LoadWithoutBarrier ())
3340
3345
{
3341
3346
_ASSERTE (!thread->HasThreadState (Thread::TS_GCSuspendFlags));
@@ -5810,11 +5815,6 @@ void HandleSuspensionForInterruptedThread(CONTEXT *interruptedContext)
5810
5815
if (pThread->PreemptiveGCDisabled () != TRUE )
5811
5816
return ;
5812
5817
5813
- #ifdef FEATURE_PERFTRACING
5814
- // Mark that the thread is currently in managed code.
5815
- pThread->SaveGCModeOnSuspension ();
5816
- #endif // FEATURE_PERFTRACING
5817
-
5818
5818
PCODE ip = GetIP (interruptedContext);
5819
5819
5820
5820
// This function can only be called when the interrupted thread is in
0 commit comments