Skip to content

Commit

Permalink
Change m_fPreemptiveGCDisabled to bool (dotnet/coreclr#27648)
Browse files Browse the repository at this point in the history
Commit migrated from dotnet/coreclr@96e08af
  • Loading branch information
pi1024e authored and MichalStrehovsky committed Mar 31, 2020
1 parent bd767af commit d003e6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
13 changes: 4 additions & 9 deletions src/Native/gc/sample/gcenv.ee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,14 @@ bool GCToEEInterface::IsPreemptiveGCDisabled()

bool GCToEEInterface::EnablePreemptiveGC()
{
bool bToggleGC = false;
Thread* pThread = ::GetThread();

if (pThread)
if (pThread && pThread->PreemptiveGCDisabled())
{
bToggleGC = !!pThread->PreemptiveGCDisabled();
if (bToggleGC)
{
pThread->EnablePreemptiveGC();
}
pThread->EnablePreemptiveGC();
return true;
}

return bToggleGC;
return false;
}

void GCToEEInterface::DisablePreemptiveGC()
Expand Down
4 changes: 2 additions & 2 deletions src/Native/gc/sample/gcenv.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct alloc_context;

class Thread
{
uint32_t m_fPreemptiveGCDisabled;
bool m_fPreemptiveGCDisabled;
uintptr_t m_alloc_context[16]; // Reserve enough space to fix allocation context

friend class ThreadStore;
Expand All @@ -105,7 +105,7 @@ class Thread

bool PreemptiveGCDisabled()
{
return !!m_fPreemptiveGCDisabled;
return m_fPreemptiveGCDisabled;
}

void EnablePreemptiveGC()
Expand Down
2 changes: 1 addition & 1 deletion src/Native/gc/unix/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class GCEvent::Impl
TimeSpecAdd(&endTime, milliseconds);
}
#else
#error "Don't know how to perfom timed wait on this platform"
#error "Don't know how to perform timed wait on this platform"
#endif

int st = 0;
Expand Down

0 comments on commit d003e6a

Please sign in to comment.