1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-23 18:54:50 +00:00

Add utitities for interrupting the event loop.

janet_loop1_interrupt makes the event loop compatible
with safe interruptions for custom scheduling. Does this by exposing
custom events on the event loop. A custom event schedules a function pointer
to run in a way that can interrupt
epoll_wait/poll/GetQueuedCompletionStatus.
This commit is contained in:
bakpakin
2021-07-24 20:30:36 -05:00
parent 160dd830a0
commit 6f1695ecd4
5 changed files with 128 additions and 32 deletions

View File

@@ -56,9 +56,6 @@ void janet_vm_load(JanetVM *from) {
* exit the interpeter loop when convenient. You can optionally
* use NULL to interrupt the current VM when convenient */
void janet_interpreter_interrupt(JanetVM *vm) {
if (NULL == vm) {
janet_vm.auto_suspend = 1;
} else {
vm->auto_suspend = 1;
}
vm = vm ? vm : &janet_vm;
vm->auto_suspend = 1;
}