< prev index next >
src/os/solaris/vm/os_solaris.cpp
Print this page
@@ -3588,13 +3588,26 @@
void os::Solaris::SR_handler(Thread* thread, ucontext_t* uc) {
// Save and restore errno to avoid confusing native code with EINTR
// after sigsuspend.
int old_errno = errno;
- OSThread* osthread = thread->osthread();
+ assert(thread == Thread::current_or_null_safe(), "Incorrect thread context");
+ 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, uc);
// attempt to switch the state, we assume we had a SUSPEND_REQUEST
< prev index next >