chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH] resubmission of Win32-specific EINTR handling


From: Felix
Subject: [Chicken-hackers] [PATCH] resubmission of Win32-specific EINTR handling
Date: Thu, 05 Jan 2012 03:42:31 -0500 (EST)

Attached a patch submitted recently that adds win32-specific handling
of EINTR in reado/peek-char. Without this patch Ctrl-C will be 
treated like EOF and terminate csi.

The version attached adds a CYGWIN-specific preprocessor test.

Please consider signing this off, whoever you are.


cheers,
felix
>From fd5fbd2f1ca21e2964e0a27b7768532cf8dfe9bb Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Thu, 5 Jan 2012 09:34:06 +0100
Subject: [PATCH] Added win32-specific keyboard-interrupt handling in
 read/peek char routines in C runtime system, according to
 information found here:

  http://mail.python.org/pipermail/python-bugs-list/2002-July/012579.html

Without this patch SIGINT will result in the input routine returning EOF
which makes csi exit.
---
 runtime.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/runtime.c b/runtime.c
index 3c5f3a9..7f8fa5c 100644
--- a/runtime.c
+++ b/runtime.c
@@ -3957,6 +3957,11 @@ C_regparm C_word C_fcall C_read_char(C_word port)
 
   if(c == EOF) {
     if(errno == EINTR) return C_fix(-1);
+    /* Found here:
+       http://mail.python.org/pipermail/python-bugs-list/2002-July/012579.html 
*/
+#if defined(_WIN32) && !defined(__CYGWIN__)
+    else if(GetLastError() == ERROR_OPERATION_ABORTED) return C_fix(-1);
+#endif
     else return C_SCHEME_END_OF_FILE;
   }
 
@@ -3971,6 +3976,10 @@ C_regparm C_word C_fcall C_peek_char(C_word port)
 
   if(c == EOF) {
     if(errno == EINTR) return C_fix(-1);
+    /* see above */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+    else if(GetLastError() == ERROR_OPERATION_ABORTED) return C_fix(-1);
+#endif
     else return C_SCHEME_END_OF_FILE;
   }
 
-- 
1.7.6.msysgit.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]