8222988: Use MonitorLocker rather than MutexLocker when wait/notify used

Fixed use cases in code except CMS.

Reviewed-by: rehn, dcubed
This commit is contained in:
Coleen Phillimore 2019-04-29 16:01:52 -04:00
parent ed9eac2bb9
commit ccb2e9d925
21 changed files with 91 additions and 101 deletions

View file

@ -419,14 +419,14 @@ void before_exit(JavaThread* thread) {
// A CAS or OSMutex would work just fine but then we need to manipulate
// thread state for Safepoint. Here we use Monitor wait() and notify_all()
// for synchronization.
{ MutexLocker ml(BeforeExit_lock);
{ MonitorLocker ml(BeforeExit_lock);
switch (_before_exit_status) {
case BEFORE_EXIT_NOT_RUN:
_before_exit_status = BEFORE_EXIT_RUNNING;
break;
case BEFORE_EXIT_RUNNING:
while (_before_exit_status == BEFORE_EXIT_RUNNING) {
BeforeExit_lock->wait();
ml.wait();
}
assert(_before_exit_status == BEFORE_EXIT_DONE, "invalid state");
return;