diff options
Diffstat (limited to 'Parser/intrcheck.c')
-rw-r--r-- | Parser/intrcheck.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/Parser/intrcheck.c b/Parser/intrcheck.c index 06b5840..4439864 100644 --- a/Parser/intrcheck.c +++ b/Parser/intrcheck.c @@ -21,7 +21,7 @@ PyOS_FiniInterrupts(void) int PyOS_InterruptOccurred(void) { - _wyield(); + _wyield(); } #define OK @@ -47,7 +47,7 @@ PyOS_InterruptOccurred(void) void PyOS_InitInterrupts(void) { - _go32_want_ctrl_break(1 /* TRUE */); + _go32_want_ctrl_break(1 /* TRUE */); } void @@ -58,7 +58,7 @@ PyOS_FiniInterrupts(void) int PyOS_InterruptOccurred(void) { - return _go32_was_ctrl_break_hit(); + return _go32_was_ctrl_break_hit(); } #else /* !__GNUC__ */ @@ -78,12 +78,12 @@ PyOS_FiniInterrupts(void) int PyOS_InterruptOccurred(void) { - int interrupted = 0; - while (kbhit()) { - if (getch() == '\003') - interrupted = 1; - } - return interrupted; + int interrupted = 0; + while (kbhit()) { + if (getch() == '\003') + interrupted = 1; + } + return interrupted; } #endif /* __GNUC__ */ @@ -106,7 +106,7 @@ static int interrupted; void PyErr_SetInterrupt(void) { - interrupted = 1; + interrupted = 1; } extern int PyErr_CheckSignals(void); @@ -114,28 +114,28 @@ extern int PyErr_CheckSignals(void); static int checksignals_witharg(void * arg) { - return PyErr_CheckSignals(); + return PyErr_CheckSignals(); } static void intcatcher(int sig) { - extern void Py_Exit(int); - static char message[] = + extern void Py_Exit(int); + static char message[] = "python: to interrupt a truly hanging Python program, interrupt once more.\n"; - switch (interrupted++) { - case 0: - break; - case 1: - write(2, message, strlen(message)); - break; - case 2: - interrupted = 0; - Py_Exit(1); - break; - } - PyOS_setsig(SIGINT, intcatcher); - Py_AddPendingCall(checksignals_witharg, NULL); + switch (interrupted++) { + case 0: + break; + case 1: + write(2, message, strlen(message)); + break; + case 2: + interrupted = 0; + Py_Exit(1); + break; + } + PyOS_setsig(SIGINT, intcatcher); + Py_AddPendingCall(checksignals_witharg, NULL); } static void (*old_siginthandler)(int) = SIG_DFL; @@ -143,23 +143,23 @@ static void (*old_siginthandler)(int) = SIG_DFL; void PyOS_InitInterrupts(void) { - if ((old_siginthandler = PyOS_setsig(SIGINT, SIG_IGN)) != SIG_IGN) - PyOS_setsig(SIGINT, intcatcher); + if ((old_siginthandler = PyOS_setsig(SIGINT, SIG_IGN)) != SIG_IGN) + PyOS_setsig(SIGINT, intcatcher); } void PyOS_FiniInterrupts(void) { - PyOS_setsig(SIGINT, old_siginthandler); + PyOS_setsig(SIGINT, old_siginthandler); } int PyOS_InterruptOccurred(void) { - if (!interrupted) - return 0; - interrupted = 0; - return 1; + if (!interrupted) + return 0; + interrupted = 0; + return 1; } #endif /* !OK */ @@ -168,7 +168,7 @@ void PyOS_AfterFork(void) { #ifdef WITH_THREAD - PyEval_ReInitThreads(); - PyThread_ReInitTLS(); + PyEval_ReInitThreads(); + PyThread_ReInitTLS(); #endif } |