[K/N][Runtime] Switch thread state when triggering CMS GC
This commit is contained in:
@@ -85,8 +85,10 @@ gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(
|
|||||||
objectFactory_(objectFactory),
|
objectFactory_(objectFactory),
|
||||||
gcScheduler_(gcScheduler),
|
gcScheduler_(gcScheduler),
|
||||||
finalizerProcessor_(make_unique<FinalizerProcessor>([this](int64_t epoch) { state_.finalized(epoch); })) {
|
finalizerProcessor_(make_unique<FinalizerProcessor>([this](int64_t epoch) { state_.finalized(epoch); })) {
|
||||||
gcScheduler_.SetScheduleGC([this]() NO_EXTERNAL_CALLS_CHECK NO_INLINE {
|
gcScheduler_.SetScheduleGC([this]() NO_INLINE {
|
||||||
RuntimeLogDebug({kTagGC}, "Scheduling GC by thread %d", konan::currentThreadId());
|
RuntimeLogDebug({kTagGC}, "Scheduling GC by thread %d", konan::currentThreadId());
|
||||||
|
// This call acquires a lock, so we need to ensure that we're in the safe state.
|
||||||
|
NativeOrUnregisteredThreadGuard guard(/* reentrant = */ true);
|
||||||
state_.schedule();
|
state_.schedule();
|
||||||
});
|
});
|
||||||
gcThread_ = std::thread([this] {
|
gcThread_ = std::thread([this] {
|
||||||
|
|||||||
Reference in New Issue
Block a user