mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-24 05:14:52 +02:00
8137165: Tests fail in SR_Handler because thread is not VMThread or JavaThread
Reviewed-by: kbarrett
This commit is contained in:
parent
32165d2889
commit
7f66b2839b
1 changed files with 13 additions and 3 deletions
|
@ -881,6 +881,13 @@ void os::free_thread(OSThread* osthread) {
|
|||
assert(osthread != NULL, "osthread not set");
|
||||
|
||||
if (Thread::current()->osthread() == osthread) {
|
||||
#ifdef ASSERT
|
||||
sigset_t current;
|
||||
sigemptyset(¤t);
|
||||
pthread_sigmask(SIG_SETMASK, NULL, ¤t);
|
||||
assert(!sigismember(¤t, SR_signum), "SR signal should not be blocked!");
|
||||
#endif
|
||||
|
||||
// Restore caller's signal mask
|
||||
sigset_t sigmask = osthread->caller_sigmask();
|
||||
pthread_sigmask(SIG_SETMASK, &sigmask, NULL);
|
||||
|
@ -3903,7 +3910,8 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
|
|||
// after sigsuspend.
|
||||
int old_errno = errno;
|
||||
|
||||
Thread* thread = Thread::current();
|
||||
Thread* thread = Thread::current_or_null_safe();
|
||||
assert(thread != NULL, "Missing current thread in SR_handler");
|
||||
OSThread* osthread = thread->osthread();
|
||||
assert(thread->is_VM_thread() || thread->is_Java_thread(), "Must be VMThread or JavaThread");
|
||||
|
||||
|
@ -3915,7 +3923,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) {
|
|||
os::SuspendResume::State state = osthread->sr.suspended();
|
||||
if (state == os::SuspendResume::SR_SUSPENDED) {
|
||||
sigset_t suspend_set; // signals for sigsuspend()
|
||||
|
||||
sigemptyset(&suspend_set);
|
||||
// get current set of blocked signals and unblock resume signal
|
||||
pthread_sigmask(SIG_BLOCK, NULL, &suspend_set);
|
||||
sigdelset(&suspend_set, SR_signum);
|
||||
|
@ -4169,6 +4177,7 @@ static bool call_chained_handler(struct sigaction *actp, int sig,
|
|||
|
||||
// try to honor the signal mask
|
||||
sigset_t oset;
|
||||
sigemptyset(&oset);
|
||||
pthread_sigmask(SIG_SETMASK, &(actp->sa_mask), &oset);
|
||||
|
||||
// call into the chained handler
|
||||
|
@ -4179,7 +4188,7 @@ static bool call_chained_handler(struct sigaction *actp, int sig,
|
|||
}
|
||||
|
||||
// restore the signal mask
|
||||
pthread_sigmask(SIG_SETMASK, &oset, 0);
|
||||
pthread_sigmask(SIG_SETMASK, &oset, NULL);
|
||||
}
|
||||
// Tell jvm's signal handler the signal is taken care of.
|
||||
return true;
|
||||
|
@ -5716,6 +5725,7 @@ void Parker::park(bool isAbsolute, jlong time) {
|
|||
// Don't catch signals while blocked; let the running threads have the signals.
|
||||
// (This allows a debugger to break into the running thread.)
|
||||
sigset_t oldsigs;
|
||||
sigemptyset(&oldsigs);
|
||||
sigset_t* allowdebug_blocked = os::Linux::allowdebug_blocked_signals();
|
||||
pthread_sigmask(SIG_BLOCK, allowdebug_blocked, &oldsigs);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue