8217794: Missing termination check results violation of termination invariant

Reviewed-by: tschatzl, shade
This commit is contained in:
Zhengyu Gu 2019-01-29 12:12:27 -05:00
parent 4c63f4d399
commit 244768cbab

View File

@ -65,6 +65,13 @@ bool OWSTTaskTerminator::offer_termination(TerminatorTerminator* terminator) {
return true;
} else {
_blocker->lock_without_safepoint_check();
// There is possibility that termination is reached between dropping the lock
// before returning from do_spin_master_work() and acquiring lock above.
if (_offered_termination == _n_threads) {
_blocker->unlock();
assert(!peek_in_queue_set(), "Precondition");
return true;
}
}
} else {
_blocker->wait(true, WorkStealingSleepMillis);