aboutsummaryrefslogtreecommitdiff
path: root/src/core/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core.c')
-rw-r--r--src/core/core.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/core.c b/src/core/core.c
index 648f54a..7d1b91e 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -74,6 +74,10 @@
#include "memmap.h"
#include "fops.h"
#include "bops.h"
+#if !defined(_WIN32) && !defined(__wasm__)
+#define HOLD_THREADS
+#endif
+#include "hold.h"
#ifndef JTYPE
#define JTYPE char
@@ -295,6 +299,12 @@ static Cell hostcall(Cell op, Cell a, Cell b, Cell c)
#else
return -1;
#endif
+ case 57: {
+ Cell r = hold_enter(m, (uint64_t)MW, a, b);
+ if (r == -2) { fflush(stdout); fprintf(stderr, "zy: hold block %d was entered while block %d was held; hold blocks are entered in the order they are declared\n", (int)a, hold_top); exit(2); }
+ return r;
+ }
+ case 58: return hold_leave(m, (uint64_t)MW, a, b);
case 56: return cb_r; /* the return stack pointer as of the gate store: the word after the top return address */
case 1:
if (zcstr(a, path, 1024) < 0) return -1;
@@ -7646,7 +7656,7 @@ static void *context_worker(void *opaque) {
if (!context->requested_exit) context->exit_code = context_cancelled() ? 0 : stopped(back) ? -1 : inmem(sp) ? (int)m[sp] : 0;
context_channel_close(context->worker_channel.handle);
while (context_children) context_join(context_children->token, 1);
- context_engine_free(); context_current = 0; return 0;
+ hold_release_all(); context_engine_free(); context_current = 0; return 0;
}
static Cell context_start(Cell entry, Cell channel) {
VmContext *context; int fd[2], i; pthread_attr_t attributes; Cell saved;