diff --git a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp index 6175f15676c..53e12711a13 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp @@ -68,7 +68,7 @@ void ShenandoahControlThread::run_service() { // Figure out if we have pending requests. const bool alloc_failure_pending = ShenandoahCollectorPolicy::is_allocation_failure(cancelled_cause); - const bool is_gc_requested = _gc_requested.is_set(); + const bool is_gc_requested = _gc_requested.try_unset(); const GCCause::Cause requested_gc_cause = _requested_gc_cause; // Choose which GC mode to run in. The block below should select a single mode. @@ -406,7 +406,6 @@ void ShenandoahControlThread::handle_requested_gc(GCCause::Cause cause) { } void ShenandoahControlThread::notify_gc_waiters() { - _gc_requested.unset(); MonitorLocker ml(&_gc_waiters_lock); ml.notify_all(); }