< prev index next >
src/hotspot/os/posix/os_posix.cpp
Print this page
*** 2073,2086 ****
// In particular a thread must never block on the Threads_lock while
// holding the Parker:: mutex. If safepoints are pending both the
// the ThreadBlockInVM() CTOR and DTOR may grab Threads_lock.
ThreadBlockInVM tbivm(jt);
// Don't wait if cannot get lock since interference arises from
! // unparking. Also re-check interrupt before trying wait.
! if (jt->is_interrupted(false) ||
! pthread_mutex_trylock(_mutex) != 0) {
return;
}
int status;
if (_counter > 0) { // no wait needed
--- 2073,2088 ----
// In particular a thread must never block on the Threads_lock while
// holding the Parker:: mutex. If safepoints are pending both the
// the ThreadBlockInVM() CTOR and DTOR may grab Threads_lock.
ThreadBlockInVM tbivm(jt);
+ // Can't access interrupt state now that we are _thread_blocked. If we've
+ // been interrupted since we checked above then _counter will be > 0.
+
// Don't wait if cannot get lock since interference arises from
! // unparking.
! if (pthread_mutex_trylock(_mutex) != 0) {
return;
}
int status;
if (_counter > 0) { // no wait needed
< prev index next >