< prev index next >

src/hotspot/os/solaris/os_solaris.cpp

Print this page

        

*** 1022,1032 **** const hrtime_t now = gethrtime(); const hrtime_t prev = max_hrtime; if (now <= prev) { return prev; // same or retrograde time; } ! const hrtime_t obsv = Atomic::cmpxchg(now, &max_hrtime, prev); assert(obsv >= prev, "invariant"); // Monotonicity // If the CAS succeeded then we're done and return "now". // If the CAS failed and the observed value "obsv" is >= now then // we should return "obsv". If the CAS failed and now > obsv > prv then // some other thread raced this thread and installed a new value, in which case --- 1022,1032 ---- const hrtime_t now = gethrtime(); const hrtime_t prev = max_hrtime; if (now <= prev) { return prev; // same or retrograde time; } ! const hrtime_t obsv = Atomic::cmpxchg(&max_hrtime, prev, now); assert(obsv >= prev, "invariant"); // Monotonicity // If the CAS succeeded then we're done and return "now". // If the CAS failed and the observed value "obsv" is >= now then // we should return "obsv". If the CAS failed and now > obsv > prv then // some other thread raced this thread and installed a new value, in which case
*** 1982,1992 **** static int check_pending_signals() { int ret; while (true) { for (int i = 0; i < Sigexit + 1; i++) { jint n = pending_signals[i]; ! if (n > 0 && n == Atomic::cmpxchg(n - 1, &pending_signals[i], n)) { return i; } } JavaThread *thread = JavaThread::current(); ThreadBlockInVM tbivm(thread); --- 1982,1992 ---- static int check_pending_signals() { int ret; while (true) { for (int i = 0; i < Sigexit + 1; i++) { jint n = pending_signals[i]; ! if (n > 0 && n == Atomic::cmpxchg(&pending_signals[i], n, n - 1)) { return i; } } JavaThread *thread = JavaThread::current(); ThreadBlockInVM tbivm(thread);
*** 4708,4718 **** assert(_nParked == 0, "invariant"); int v; 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 ... // See http://monaco.sfbay/detail.jsf?cr=5094058. --- 4708,4718 ---- assert(_nParked == 0, "invariant"); int v; 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 ... // See http://monaco.sfbay/detail.jsf?cr=5094058.
*** 4746,4756 **** guarantee(_nParked == 0, "invariant"); int v; for (;;) { v = _Event; ! if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; } guarantee(v >= 0, "invariant"); if (v != 0) return OS_OK; int ret = OS_TIMEOUT; --- 4746,4756 ---- guarantee(_nParked == 0, "invariant"); int v; for (;;) { v = _Event; ! if (Atomic::cmpxchg(&_Event, v, v-1) == v) break; } guarantee(v >= 0, "invariant"); if (v != 0) return OS_OK; int ret = OS_TIMEOUT;
< prev index next >