< 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,135 ****
//
// -------------------------------------------------------------------------
int JvmtiRawMonitor::SimpleEnter (Thread * Self) {
for (;;) {
! if (Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
return OS_OK ;
}
ObjectWaiter Node (Self) ;
Self->_ParkEvent->reset() ; // strictly optional
--- 125,135 ----
//
// -------------------------------------------------------------------------
int JvmtiRawMonitor::SimpleEnter (Thread * Self) {
for (;;) {
! if (Atomic::replace_if_null(Self, &_owner)) {
return OS_OK ;
}
ObjectWaiter Node (Self) ;
Self->_ParkEvent->reset() ; // strictly optional
*** 137,147 ****
RawMonitor_lock->lock_without_safepoint_check() ;
Node._next = _EntryList ;
_EntryList = &Node ;
OrderAccess::fence() ;
! if (_owner == NULL && Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
_EntryList = Node._next ;
RawMonitor_lock->unlock() ;
return OS_OK ;
}
RawMonitor_lock->unlock() ;
--- 137,147 ----
RawMonitor_lock->lock_without_safepoint_check() ;
Node._next = _EntryList ;
_EntryList = &Node ;
OrderAccess::fence() ;
! if (_owner == NULL && Atomic::replace_if_null(Self, &_owner)) {
_EntryList = Node._next ;
RawMonitor_lock->unlock() ;
return OS_OK ;
}
RawMonitor_lock->unlock() ;
< prev index next >