summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--byterun/signals.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/byterun/signals.c b/byterun/signals.c
index 25920a9ed..d7d91504c 100644
--- a/byterun/signals.c
+++ b/byterun/signals.c
@@ -132,6 +132,16 @@ CAMLexport void enter_blocking_section(void)
CAMLexport void leave_blocking_section(void)
{
+#ifdef _WIN32
+ /* Under Win32, asynchronous signals such as ctrl-C are not processed
+ immediately (see ctrl_handler in win32.c), but simply set
+ pending_signal and let the system call run to completion.
+ Hence, test pending_signal here and act upon it, before we get
+ a chance to process the result of the system call. */
+ int signal_number = pending_signal;
+ pending_signal = 0;
+ if (signal_number) execute_signal(signal_number, 1);
+#endif
if (leave_blocking_section_hook != NULL) leave_blocking_section_hook();
Assert(async_signal_mode);
async_signal_mode = 0;