mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 01:24:33 +02:00
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:
parent
ed9eac2bb9
commit
ccb2e9d925
21 changed files with 91 additions and 101 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue