< prev index next >
src/hotspot/share/prims/jvmtiRawMonitor.cpp
Print this page
rev 48406 : 8194406: Use Atomic::replace_if_null
Reviewed-by: coleenp, dholmes
@@ -125,11 +125,11 @@
//
// -------------------------------------------------------------------------
int JvmtiRawMonitor::SimpleEnter (Thread * Self) {
for (;;) {
- if (Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
+ if (Atomic::replace_if_null(Self, &_owner)) {
return OS_OK ;
}
ObjectWaiter Node (Self) ;
Self->_ParkEvent->reset() ; // strictly optional
@@ -137,11 +137,11 @@
RawMonitor_lock->lock_without_safepoint_check() ;
Node._next = _EntryList ;
_EntryList = &Node ;
OrderAccess::fence() ;
- if (_owner == NULL && Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
+ if (_owner == NULL && Atomic::replace_if_null(Self, &_owner)) {
_EntryList = Node._next ;
RawMonitor_lock->unlock() ;
return OS_OK ;
}
RawMonitor_lock->unlock() ;
< prev index next >