diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp index 281e81c264fc2dd6e69c691f5c330a4af90dd6e8..6aa3ebc0a7684435dff9d5050f76cff8d4566bdb 100644 --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -4683,6 +4683,7 @@ void Parker::park(bool isAbsolute, jlong time) { // Return immediately if a permit is available. if (_counter > 0) { _counter = 0 ; + OrderAccess::fence(); return ; } @@ -4725,6 +4726,7 @@ void Parker::park(bool isAbsolute, jlong time) { _counter = 0; status = pthread_mutex_unlock(_mutex); assert (status == 0, "invariant") ; + OrderAccess::fence(); return; } @@ -4765,6 +4767,7 @@ void Parker::park(bool isAbsolute, jlong time) { jt->java_suspend_self(); } + OrderAccess::fence(); } void Parker::unpark() { diff --git a/src/os/solaris/vm/os_solaris.cpp b/src/os/solaris/vm/os_solaris.cpp index 13abbf9d4b9adc7ce400e2a9fae0dd88cd123bfa..b85bcef8cdd1dbbef39383c4bc2139bda2b185d5 100644 --- a/src/os/solaris/vm/os_solaris.cpp +++ b/src/os/solaris/vm/os_solaris.cpp @@ -5803,6 +5803,7 @@ void Parker::park(bool isAbsolute, jlong time) { // Return immediately if a permit is available. if (_counter > 0) { _counter = 0 ; + OrderAccess::fence(); return ; } @@ -5846,6 +5847,7 @@ void Parker::park(bool isAbsolute, jlong time) { _counter = 0; status = os::Solaris::mutex_unlock(_mutex); assert (status == 0, "invariant") ; + OrderAccess::fence(); return; } @@ -5892,6 +5894,7 @@ void Parker::park(bool isAbsolute, jlong time) { jt->java_suspend_self(); } + OrderAccess::fence(); } void Parker::unpark() {