From: Matt Birkholz Date: Tue, 5 Jan 2016 22:40:55 +0000 (-0700) Subject: Add an ignore_status_change parameter to OS_pause for SMP-IDLE. X-Git-Tag: mit-scheme-pucked-9.2.12~376^2~6 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=60ed70f40b279fb64866846b13b819ab600450d5;p=mit-scheme.git Add an ignore_status_change parameter to OS_pause for SMP-IDLE. OS_pause previously returned immediately if there were pending interrupts OR subprocess status changes, as required by a blocking test-select-registry primitive. That made it useless to the SMP-IDLE primitive, which spins in the idle loop until the io-waiter (or a timer interrupt handler) gets around to syncing subprocess statuses. It will spin too after getting a SIGCHLD until statuses are synced. --- diff --git a/src/microcode/ntio.c b/src/microcode/ntio.c index 9c35d0b63..0d9acf5b6 100644 --- a/src/microcode/ntio.c +++ b/src/microcode/ntio.c @@ -848,7 +848,7 @@ OS_test_select_registry (select_registry_t registry, int blockp) } int -OS_pause (void) +OS_pause (bool ignore_status_change) { /* Wait-for-io must spin. */ return diff --git a/src/microcode/os2io.c b/src/microcode/os2io.c index 547e7ffa5..64005bdc8 100644 --- a/src/microcode/os2io.c +++ b/src/microcode/os2io.c @@ -566,7 +566,7 @@ OS_test_select_registry (select_registry_t registry, int blockp) } int -OS_pause (void) +OS_pause (bool ignore_status_change) { /* Wait-for-io must spin. */ return diff --git a/src/microcode/osio.h b/src/microcode/osio.h index fc5f050ce..4bef9dc65 100644 --- a/src/microcode/osio.h +++ b/src/microcode/osio.h @@ -109,6 +109,6 @@ extern int OS_test_select_registry (select_registry_t registry, int blockp); extern int OS_test_select_descriptor (int fd, int blockp, unsigned int mode); -extern int OS_pause (void); +extern int OS_pause (bool ignore_status_change); #endif /* SCM_OSIO_H */ diff --git a/src/microcode/prosio.c b/src/microcode/prosio.c index 6a13a998b..872f3833f 100644 --- a/src/microcode/prosio.c +++ b/src/microcode/prosio.c @@ -332,7 +332,7 @@ DEFINE_PRIMITIVE ("TEST-SELECT-REGISTRY", Prim_test_selreg, 4, 4, 0) if ((VECTOR_LENGTH (vmode)) < rl) error_bad_range_arg (4); result = ((rl == 0) - ? (blockp ? (OS_pause ()) : SELECT_INTERRUPT) + ? (blockp ? (OS_pause (0)) : SELECT_INTERRUPT) : (OS_test_select_registry (r, blockp))); if (result > 0) { diff --git a/src/microcode/uxio.c b/src/microcode/uxio.c index 6ee00f59b..12e9ef3cf 100644 --- a/src/microcode/uxio.c +++ b/src/microcode/uxio.c @@ -853,7 +853,7 @@ OS_test_select_descriptor (int fd, int blockp, unsigned int mode) #endif /* not HAVE_POLL */ int -OS_pause (void) +OS_pause (bool ignore_status_change) { #ifdef HAVE_SIGSUSPEND sigset_t old, new; @@ -861,9 +861,9 @@ OS_pause (void) UX_sigfillset (&new); UX_sigprocmask (SIG_SETMASK, &new, &old); - if (OS_process_any_status_change ()) + if (!ignore_status_change && OS_process_any_status_change ()) n = SELECT_PROCESS_STATUS_CHANGE; - else if (pending_interrupts_p ()) + else if ((GET_INT_CODE) != 0) n = SELECT_INTERRUPT; else { @@ -876,8 +876,8 @@ OS_pause (void) UX_sigprocmask (SIG_SETMASK, &old, NULL); #else /* not HAVE_SIGSUSPEND */ INTERRUPTABLE_EXTENT - (n, (((OS_process_any_status_change ()) - || (pending_interrupts_p ())) + (n, (((!ignore_status_change && (OS_process_any_status_change ())) + || ((GET_INT_CODE) != 0)) ? ((errno = EINTR), (-1)) : ((UX_pause ()), (0)))); if (OS_process_any_status_change())