< prev index next >

src/hotspot/os/posix/os_posix.cpp

Print this page

        

*** 1898,1908 **** int v; // atomically decrement _event for (;;) { v = _event; ! if (Atomic::cmpxchg(v - 1, &_event, v) == v) break; } guarantee(v >= 0, "invariant"); if (v == 0) { // Do this the hard way by blocking ... int status = pthread_mutex_lock(_mutex); --- 1898,1908 ---- int v; // atomically decrement _event for (;;) { v = _event; ! if (Atomic::cmpxchg(&_event, v, v - 1) == v) break; } guarantee(v >= 0, "invariant"); if (v == 0) { // Do this the hard way by blocking ... int status = pthread_mutex_lock(_mutex);
*** 1938,1948 **** int v; // atomically decrement _event for (;;) { v = _event; ! if (Atomic::cmpxchg(v - 1, &_event, v) == v) break; } guarantee(v >= 0, "invariant"); if (v == 0) { // Do this the hard way by blocking ... struct timespec abst; --- 1938,1948 ---- int v; // atomically decrement _event for (;;) { v = _event; ! if (Atomic::cmpxchg(&_event, v, v - 1) == v) break; } guarantee(v >= 0, "invariant"); if (v == 0) { // Do this the hard way by blocking ... struct timespec abst;
*** 1996,2006 **** // shake out uses of park() and unpark() without checking state conditions // properly. This spurious return doesn't manifest itself in any user code // but only in the correctly written condition checking loops of ObjectMonitor, // Mutex/Monitor, Thread::muxAcquire and JavaThread::sleep ! if (Atomic::xchg(1, &_event) >= 0) return; int status = pthread_mutex_lock(_mutex); assert_status(status == 0, status, "mutex_lock"); int anyWaiters = _nParked; assert(anyWaiters == 0 || anyWaiters == 1, "invariant"); --- 1996,2006 ---- // shake out uses of park() and unpark() without checking state conditions // properly. This spurious return doesn't manifest itself in any user code // but only in the correctly written condition checking loops of ObjectMonitor, // Mutex/Monitor, Thread::muxAcquire and JavaThread::sleep ! if (Atomic::xchg(&_event, 1) >= 0) return; int status = pthread_mutex_lock(_mutex); assert_status(status == 0, status, "mutex_lock"); int anyWaiters = _nParked; assert(anyWaiters == 0 || anyWaiters == 1, "invariant");
*** 2044,2054 **** // Optional fast-path check: // Return immediately if a permit is available. // We depend on Atomic::xchg() having full barrier semantics // since we are doing a lock-free update to _counter. ! if (Atomic::xchg(0, &_counter) > 0) return; Thread* thread = Thread::current(); assert(thread->is_Java_thread(), "Must be JavaThread"); JavaThread *jt = (JavaThread *)thread; --- 2044,2054 ---- // Optional fast-path check: // Return immediately if a permit is available. // We depend on Atomic::xchg() having full barrier semantics // since we are doing a lock-free update to _counter. ! if (Atomic::xchg(&_counter, 0) > 0) return; Thread* thread = Thread::current(); assert(thread->is_Java_thread(), "Must be JavaThread"); JavaThread *jt = (JavaThread *)thread;
< prev index next >