hotspot/src/os/linux/vm/os_linux.cpp
changeset 40377 b77bf599c11b
parent 40010 e32d5e545789
child 40655 9f644073d3a0
equal deleted inserted replaced
40376:15e772ff7ff4 40377:b77bf599c11b
  3969 //        and blocks in sigsuspend until continued
  3969 //        and blocks in sigsuspend until continued
  3970 //  - resume:
  3970 //  - resume:
  3971 //      - sets target osthread state to continue
  3971 //      - sets target osthread state to continue
  3972 //      - sends signal to end the sigsuspend loop in the SR_handler
  3972 //      - sends signal to end the sigsuspend loop in the SR_handler
  3973 //
  3973 //
  3974 //  Note that the SR_lock plays no role in this suspend/resume protocol.
  3974 //  Note that the SR_lock plays no role in this suspend/resume protocol,
       
  3975 //  but is checked for NULL in SR_handler as a thread termination indicator.
  3975 
  3976 
  3976 static void resume_clear_context(OSThread *osthread) {
  3977 static void resume_clear_context(OSThread *osthread) {
  3977   osthread->set_ucontext(NULL);
  3978   osthread->set_ucontext(NULL);
  3978   osthread->set_siginfo(NULL);
  3979   osthread->set_siginfo(NULL);
  3979 }
  3980 }
  4002   // after sigsuspend.
  4003   // after sigsuspend.
  4003   int old_errno = errno;
  4004   int old_errno = errno;
  4004 
  4005 
  4005   Thread* thread = Thread::current_or_null_safe();
  4006   Thread* thread = Thread::current_or_null_safe();
  4006   assert(thread != NULL, "Missing current thread in SR_handler");
  4007   assert(thread != NULL, "Missing current thread in SR_handler");
       
  4008 
       
  4009   // On some systems we have seen signal delivery get "stuck" until the signal
       
  4010   // mask is changed as part of thread termination. Check that the current thread
       
  4011   // has not already terminated (via SR_lock()) - else the following assertion
       
  4012   // will fail because the thread is no longer a JavaThread as the ~JavaThread
       
  4013   // destructor has completed.
       
  4014 
       
  4015   if (thread->SR_lock() == NULL) {
       
  4016     return;
       
  4017   }
       
  4018 
       
  4019   assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
       
  4020 
  4007   OSThread* osthread = thread->osthread();
  4021   OSThread* osthread = thread->osthread();
  4008   assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
       
  4009 
  4022 
  4010   os::SuspendResume::State current = osthread->sr.state();
  4023   os::SuspendResume::State current = osthread->sr.state();
  4011   if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
  4024   if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
  4012     suspend_save_context(osthread, siginfo, context);
  4025     suspend_save_context(osthread, siginfo, context);
  4013 
  4026