mirror of
https://github.com/janet-lang/janet
synced 2026-11-27 17:33:09 +00:00
Minimal fix for #1948 - ev cancel in janet_dobytes
run.c should initialize fibers nicely, but a more general fix is ideal for top level functions that call into the event loop.
This commit is contained in:
2 files changed
+7
-1
No files matched your search
+1
-1
@@ -26,7 +26,7 @@
|
||||
#include "state.h"
|
||||
#endif
|
||||
|
||||
/* Run a string of code. The return value is a set of error flags, JANET_DO_ERROR_RUNTIME, JANET_DO_ERROR_COMPILE, and JANET_DOR_ERROR_PARSE if
|
||||
/* Run a string of code. The return value is a set of error flags, JANET_DO_ERROR_RUNTIME, JANET_DO_ERROR_COMPILE, and JANET_DO_ERROR_PARSE if
|
||||
* any errors were encountered in those phases. More information is printed to stderr. */
|
||||
int janet_dobytes(JanetTable *env, const uint8_t *bytes, int32_t len, const char *sourcePath, Janet *out) {
|
||||
JanetParser *parser;
|
||||
|
||||
@@ -1562,6 +1562,12 @@ static JanetSignal janet_check_can_resume(JanetFiber *fiber, Janet *out, int is_
|
||||
*out = janet_wrap_string(str);
|
||||
return JANET_SIGNAL_ERROR;
|
||||
}
|
||||
#ifdef JANET_EV
|
||||
if (janet_vm.fiber == NULL) {
|
||||
/* Make sure we don't run root fibers without this flag */
|
||||
fiber->gc.flags |= JANET_FIBER_EV_GCFLAG_ROOT;
|
||||
}
|
||||
#endif
|
||||
return JANET_SIGNAL_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user