summaryrefslogtreecommitdiff
path: root/kernel/byterun
diff options
context:
space:
mode:
authorGravatar Stephane Glondu <steph@glondu.net>2011-04-19 16:44:20 +0200
committerGravatar Stephane Glondu <steph@glondu.net>2011-04-19 16:44:20 +0200
commit9d27ae09786866b6e3d7b79d1fa7667e5e2aa309 (patch)
treea418d1edb3d53cdb4185b9719b7a70822cf5a24d /kernel/byterun
parent6b691bbd2101fd39395c0d2135fd7c06a8915e14 (diff)
Imported Upstream version 8.3.pl2upstream/8.3.pl2
Diffstat (limited to 'kernel/byterun')
-rw-r--r--kernel/byterun/coq_interp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/kernel/byterun/coq_interp.c b/kernel/byterun/coq_interp.c
index 98ef2791..cce2319b 100644
--- a/kernel/byterun/coq_interp.c
+++ b/kernel/byterun/coq_interp.c
@@ -14,6 +14,7 @@
for fast computation of bounded (31bits) integers */
#include <stdio.h>
+#include <signal.h>
#include "coq_gc.h"
#include "coq_instruct.h"
#include "coq_fix_code.h"
@@ -157,6 +158,12 @@ sp is a local copy of the global variable extern_sp. */
#endif
#endif
+/* For signal handling, we highjack some code from the caml runtime */
+
+extern intnat caml_signals_are_pending;
+extern intnat caml_pending_signals[];
+extern void caml_process_pending_signals(void);
+
/* The interpreter itself */
value coq_interprete
@@ -414,8 +421,13 @@ value coq_interprete
realloc_coq_stack(Coq_stack_threshold);
sp = coq_sp;
}
+ /* We also check for signals */
+ if (caml_signals_are_pending) {
+ /* If there's a Ctrl-C, we reset the vm */
+ if (caml_pending_signals[SIGINT]) { coq_sp = coq_stack_high; }
+ caml_process_pending_signals();
+ }
Next;
- /* Fall through CHECK_SIGNALS */
Instruct(APPTERM) {
int nargs = *pc++;