< prev index next >
src/os/linux/vm/os_linux.cpp
Print this page
@@ -4002,13 +4002,24 @@
// after sigsuspend.
int old_errno = errno;
Thread* thread = Thread::current_or_null_safe();
assert(thread != NULL, "Missing current thread in SR_handler");
- OSThread* osthread = thread->osthread();
+
+ // 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 >