From: Matt Birkholz Date: Fri, 19 Oct 2012 18:48:59 +0000 (-0700) Subject: gtk: Vanquish spinning gtk-thread evil (again). X-Git-Tag: mit-scheme-pucked-9.2.12~553 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=002091e565f9bc1c9b13c340458969464fb9e735;p=mit-scheme.git gtk: Vanquish spinning gtk-thread evil (again). tests/runtime/test-gtk spins like crazy again. With a gtk-thread always ready to run and no thread waiting for io, wait-for-io is never called and maybe-signal-io-thread-events never blocks. Unfortunately test-select-registry always returned INTERRUPT for non-blocking selects with an empty registry. It needs to return PROCESS-STATUS- CHANGE when there is a pending process status change so that handle- subprocess-status-change runs. Thus OS_pause got a new argument: blockp. In uxio.c it can call OS_process_any_status_change and return PROCESS-STATUS-CHANGE when necessary. --- diff --git a/src/microcode/ntio.c b/src/microcode/ntio.c index 3a4781ff2..727a92555 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 (int blockp) { /* Wait-for-io must spin. */ return diff --git a/src/microcode/os2io.c b/src/microcode/os2io.c index 5511c057e..59f2de1a2 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 (int blockp) { /* Wait-for-io must spin. */ return diff --git a/src/microcode/osio.h b/src/microcode/osio.h index 3265f7636..f75a4b17d 100644 --- a/src/microcode/osio.h +++ b/src/microcode/osio.h @@ -112,7 +112,7 @@ 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 (int blockp); extern select_registry_t arg_select_registry (int arg_number); #endif /* SCM_OSIO_H */ diff --git a/src/microcode/prosio.c b/src/microcode/prosio.c index d95286823..c35ade664 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) + ? (OS_pause (blockp)) : (OS_test_select_registry (r, blockp))); if (result > 0) { diff --git a/src/microcode/uxio.c b/src/microcode/uxio.c index d8af4a2ad..35c8db642 100644 --- a/src/microcode/uxio.c +++ b/src/microcode/uxio.c @@ -863,8 +863,8 @@ OS_test_select_descriptor (int fd, int blockp, unsigned int mode) #endif /* not HAVE_POLL */ -int -OS_pause (void) +static int +safe_pause (void) { #ifdef HAVE_SIGSUSPEND sigset_t old, new; @@ -894,3 +894,16 @@ OS_pause (void) : SELECT_INTERRUPT); #endif } + +int +OS_pause (int blockp) +{ + if (!blockp) + { + return ((OS_process_any_status_change ()) + ? SELECT_PROCESS_STATUS_CHANGE + : SELECT_INTERRUPT); + } + else + return (safe_pause ()); +}