From fbc427ca6fb9053fc6fd43ade8064156354ae51c Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Thu, 6 Sep 2012 08:58:24 -0700 Subject: [PATCH] Fix OS_pause on Unix to correctly restore the sigmask. --- src/microcode/uxio.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/microcode/uxio.c b/src/microcode/uxio.c index 02f91a566..2781a0182 100644 --- a/src/microcode/uxio.c +++ b/src/microcode/uxio.c @@ -857,18 +857,24 @@ OS_pause (void) { #ifdef HAVE_SIGSUSPEND sigset_t old, new; + int n; UX_sigfillset (&new); UX_sigprocmask (SIG_SETMASK, &new, &old); if (OS_process_any_status_change ()) - return (SELECT_PROCESS_STATUS_CHANGE); - if (pending_interrupts_p ()) - return (SELECT_INTERRUPT); - UX_sigsuspend (&old); + n = SELECT_PROCESS_STATUS_CHANGE; + else if (pending_interrupts_p ()) + n = SELECT_INTERRUPT; + else + { + UX_sigsuspend (&old); + if (OS_process_any_status_change ()) + n = SELECT_PROCESS_STATUS_CHANGE; + else + n = SELECT_INTERRUPT; + } UX_sigprocmask (SIG_SETMASK, &old, NULL); - if (OS_process_any_status_change ()) - return (SELECT_PROCESS_STATUS_CHANGE); - return (SELECT_INTERRUPT); + return (n); #else /* Wait-for-io must spin. */ return -- 2.25.1