From: Matt Birkholz Date: Wed, 15 Jul 2015 10:16:58 +0000 (-0700) Subject: Add an ignore_status_change parameter to OS_pause for SMP-IDLE. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=80b4bde91ba1c3cc21bda54580ec41f5fc37fffd;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 459fbd0fb..dc503b4f4 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 07bcac4af..dfb3aaf99 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 d2f28eed8..da0d862a2 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 44cc85b1d..9fcfea72f 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 5dcd3d4d5..83304b300 100644 --- a/src/microcode/uxio.c +++ b/src/microcode/uxio.c @@ -861,7 +861,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; @@ -869,7 +869,7 @@ 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 ((GET_INT_CODE) != 0) n = SELECT_INTERRUPT; @@ -884,7 +884,7 @@ OS_pause (void) UX_sigprocmask (SIG_SETMASK, &old, NULL); #else /* not HAVE_SIGSUSPEND */ INTERRUPTABLE_EXTENT - (n, (((OS_process_any_status_change ()) + (n, (((!ignore_status_change && (OS_process_any_status_change ())) || ((GET_INT_CODE) != 0)) ? ((errno = EINTR), (-1)) : ((UX_pause ()), (0))));