In the STD_*_SYSTEM_CALL macros, if the system call returns EINTR,
authorTaylor R. Campbell <net/mumble/campbell>
Sun, 8 Mar 2009 00:02:09 +0000 (00:02 +0000)
committerTaylor R. Campbell <net/mumble/campbell>
Sun, 8 Mar 2009 00:02:09 +0000 (00:02 +0000)
deliver pending Scheme interrupts.  This prevents most system calls
from indefinitely blocking all Scheme threads and keyboard
interruptions.

v7/src/microcode/ux.h

index 5fbc4658c055f39da6406b4a0945678c147fc5d7..d93f46fe3b220ec4a29310713b9f16ed71fcf485 100644 (file)
@@ -1,10 +1,10 @@
 /* -*-C-*-
 
-$Id: ux.h,v 1.88 2008/01/30 20:02:21 cph Exp $
+$Id: ux.h,v 1.89 2009/03/08 00:02:09 riastradh Exp $
 
 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
     1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-    2006, 2007, 2008 Massachusetts Institute of Technology
+    2006, 2007, 2008, 2009 Massachusetts Institute of Technology
 
 This file is part of MIT/GNU Scheme.
 
@@ -852,22 +852,31 @@ extern void UX_prim_check_errno (enum syscall_names name);
 #define STD_VOID_SYSTEM_CALL(name, expression)                         \
 {                                                                      \
   while ((expression) < 0)                                             \
-    if (errno != EINTR)                                                        \
-      error_system_call (errno, (name));                               \
+    {                                                                  \
+      if (errno != EINTR)                                              \
+       error_system_call (errno, (name));                              \
+      deliver_pending_interrupts ();                                   \
+    }                                                                  \
 }
 
 #define STD_UINT_SYSTEM_CALL(name, result, expression)                 \
 {                                                                      \
   while (((result) = (expression)) < 0)                                        \
-    if (errno != EINTR)                                                        \
-      error_system_call (errno, (name));                               \
+    {                                                                  \
+      if (errno != EINTR)                                              \
+       error_system_call (errno, (name));                              \
+      deliver_pending_interrupts ();                                   \
+    }                                                                  \
 }
 
 #define STD_PTR_SYSTEM_CALL(name, result, expression)                  \
 {                                                                      \
   while (((result) = (expression)) == 0)                               \
-    if (errno != EINTR)                                                        \
-      error_system_call (errno, (name));                               \
+    {                                                                  \
+      if (errno != EINTR)                                              \
+       error_system_call (errno, (name));                              \
+      deliver_pending_interrupts ();                                   \
+    }                                                                  \
 }
 
 #endif /* SCM_UX_H */