diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 1eae71978..82879b64c 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -3,6 +3,8 @@ * iselect.c (coop_next_runnable_thread, coop_wait_for_runnable_thread): Disable interrupts so that no async is executed before a potential error_revive. + (scm_internal_select): Disable interrupts during the parts of the + code which manipulate the sleep queue and the file descriptors. 1997-11-27 Mikael Djurfeldt diff --git a/libguile/iselect.c b/libguile/iselect.c index 8b8a87912..43d05942e 100644 --- a/libguile/iselect.c +++ b/libguile/iselect.c @@ -524,10 +524,14 @@ scm_internal_select (int nfds, && timeout->tv_usec == 0) return select (nfds, readfds, writefds, exceptfds, timeout); + ++scm_ints_disabled; + /* Add our file descriptor flags to the common set. */ if (add_fd_sets (nfds, readfds, writefds, exceptfds)) { errno = EBADF; /* Several threads can't select on same fds. */ + if (!--scm_ints_disabled) + SCM_ASYNC_TICK; return -1; } @@ -554,6 +558,9 @@ scm_internal_select (int nfds, t = coop_wait_for_runnable_thread_now (&now); } + if (!--scm_ints_disabled) + SCM_ASYNC_TICK; + /* If the new thread is the same as the sleeping thread, do nothing */ if (t != curr) {