ASYNC_TICK after catching EINTR in SCM_SYSCALL
authorAndy Wingo <wingo@pobox.com>
Fri, 3 Dec 2010 14:17:35 +0000 (15:17 +0100)
committerAndy Wingo <wingo@pobox.com>
Fri, 3 Dec 2010 14:17:35 +0000 (15:17 +0100)
* libguile/_scm.h (SCM_SYSCALL): As in scm_syserror, do a SCM_ASYNC_TICK
  before resuming the syscall after an EINTR.

libguile/_scm.h

index eb3a8a2..5421116 100644 (file)
 #include "libguile/inline.h"
 #include "libguile/strings.h"
 
+/* ASYNC_TICK after finding EINTR in order to handle pending signals, if
+   any. See comment in scm_syserror. */
 #ifndef SCM_SYSCALL
 #ifdef vms
 # ifndef __GNUC__
 #  include <ssdef.h>
-#  define SCM_SYSCALL(line) do{errno = 0;line;} \
-       while(EVMSERR==errno && (vaxc$errno>>3)==(SS$_CONTROLC>>3))
+#   define SCM_SYSCALL(line)                                    \
+  do                                                            \
+    {                                                           \
+      errno = 0;                                                \
+      line;                                                     \
+      if (EVMSERR==errno && (vaxc$errno>>3)==(SS$_CONTROLC>>3)) \
+        {                                                       \
+          SCM_ASYNC_TICK;                                       \
+          continue;                                             \
+        }                                                       \
+    }                                                           \
+  while(0)
 # endif /* ndef __GNUC__ */
 #endif /* def vms */
 #endif /* ndef SCM_SYSCALL  */
 #ifndef SCM_SYSCALL
 # ifdef EINTR
 #  if (EINTR > 0)
-#   define SCM_SYSCALL(line) do{errno = 0;line;}while(EINTR==errno)
+#   define SCM_SYSCALL(line)                    \
+  do                                            \
+    {                                           \
+      errno = 0;                                \
+      line;                                     \
+      if (errno == EINTR)                       \
+        {                                       \
+          SCM_ASYNC_TICK;                       \
+          continue;                             \
+        }                                       \
+    }                                           \
+  while(0)
 #  endif /*  (EINTR > 0) */
 # endif /* def EINTR */
 #endif /* ndef SCM_SYSCALL */