< prev index next >
src/os/bsd/vm/os_bsd.cpp
Print this page
*** 2744,2757 ****
static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
// Save and restore errno to avoid confusing native code with EINTR
// after sigsuspend.
int old_errno = errno;
! Thread* thread = Thread::current();
! OSThread* osthread = thread->osthread();
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
os::SuspendResume::State current = osthread->sr.state();
if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
suspend_save_context(osthread, siginfo, context);
// attempt to switch the state, we assume we had a SUSPEND_REQUEST
--- 2744,2769 ----
static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
// Save and restore errno to avoid confusing native code with EINTR
// after sigsuspend.
int old_errno = errno;
! Thread* thread = Thread::current_or_null_safe();
! assert(thread != NULL, "Missing current thread in SR_handler");
!
! // On some systems we have seen signal delivery get "stuck" until the signal
! // mask is changed as part of thread termination. Check the current thread
! // has not already terminated (via SR_lock()) - else the following assertion
! // will fail because the thread is no longer a JavaThread as the ~JavaThread
! // destructor has completed.
!
! if (thread->SR_lock() == NULL)
! return;
!
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
+ OSThread* osthread = thread->osthread();
+
os::SuspendResume::State current = osthread->sr.state();
if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
suspend_save_context(osthread, siginfo, context);
// attempt to switch the state, we assume we had a SUSPEND_REQUEST
< prev index next >