< prev index next >
src/hotspot/os/windows/os_windows.cpp
Print this page
*** 2094,2104 ****
static int check_pending_signals() {
while (true) {
for (int i = 0; i < NSIG + 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();
--- 2094,2104 ----
static int check_pending_signals() {
while (true) {
for (int i = 0; i < NSIG + 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();
*** 3749,3759 ****
warning("crit_sect initialization failed in %s: %d\n", __FILE__, __LINE__);
} else if (Atomic::load_acquire(&process_exiting) == 0) {
if (what != EPT_THREAD) {
// Atomically set process_exiting before the critical section
// to increase the visibility between racing threads.
! Atomic::cmpxchg(GetCurrentThreadId(), &process_exiting, (DWORD)0);
}
EnterCriticalSection(&crit_sect);
if (what == EPT_THREAD && Atomic::load_acquire(&process_exiting) == 0) {
// Remove from the array those handles of the threads that have completed exiting.
--- 3749,3759 ----
warning("crit_sect initialization failed in %s: %d\n", __FILE__, __LINE__);
} else if (Atomic::load_acquire(&process_exiting) == 0) {
if (what != EPT_THREAD) {
// Atomically set process_exiting before the critical section
// to increase the visibility between racing threads.
! Atomic::cmpxchg(&process_exiting, (DWORD)0, GetCurrentThreadId());
}
EnterCriticalSection(&crit_sect);
if (what == EPT_THREAD && Atomic::load_acquire(&process_exiting) == 0) {
// Remove from the array those handles of the threads that have completed exiting.
*** 5134,5144 ****
// Consider: use atomic decrement instead of CAS-loop
int v;
for (;;) {
v = _Event;
! if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee((v == 0) || (v == 1), "invariant");
if (v != 0) return OS_OK;
// Do this the hard way by blocking ...
--- 5134,5144 ----
// Consider: use atomic decrement instead of CAS-loop
int v;
for (;;) {
v = _Event;
! if (Atomic::cmpxchg(&_Event, v, v-1) == v) break;
}
guarantee((v == 0) || (v == 1), "invariant");
if (v != 0) return OS_OK;
// Do this the hard way by blocking ...
*** 5196,5206 ****
// may call park().
// Consider: use atomic decrement instead of CAS-loop
int v;
for (;;) {
v = _Event;
! if (Atomic::cmpxchg(v-1, &_Event, v) == v) break;
}
guarantee((v == 0) || (v == 1), "invariant");
if (v != 0) return;
// Do this the hard way by blocking ...
--- 5196,5206 ----
// may call park().
// Consider: use atomic decrement instead of CAS-loop
int v;
for (;;) {
v = _Event;
! if (Atomic::cmpxchg(&_Event, v, v-1) == v) break;
}
guarantee((v == 0) || (v == 1), "invariant");
if (v != 0) return;
// Do this the hard way by blocking ...
*** 5234,5244 ****
// that it will take two back-to-back park() calls for the owning
// thread to block. This has the benefit of forcing a spurious return
// from the first park() call after an unpark() call which will help
// shake out uses of park() and unpark() without condition variables.
! if (Atomic::xchg(1, &_Event) >= 0) return;
::SetEvent(_ParkHandle);
}
--- 5234,5244 ----
// that it will take two back-to-back park() calls for the owning
// thread to block. This has the benefit of forcing a spurious return
// from the first park() call after an unpark() call which will help
// shake out uses of park() and unpark() without condition variables.
! if (Atomic::xchg(&_Event, 1) >= 0) return;
::SetEvent(_ParkHandle);
}
< prev index next >