1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-07 11:03:04 +00:00

Add initial implementation for supervisor channels.

Supervisor channels are a simple concept to more efficiently
enable dynamic, structure concurrency. When a top-level fiber
completes (or errors), it will push itself to it's supervisor
channel if it has one (instead of printing a stacktrace). This
let's another fiber poll a channel and "supervise" a set of fibers.
This commit is contained in:
Calvin Rose
2021-01-06 23:19:22 -06:00
parent ee0e1a2342
commit 4e7ad3c7ce
5 changed files with 72 additions and 23 deletions

View File

@@ -842,6 +842,7 @@ struct JanetFiber {
#ifdef JANET_EV
JanetListenerState *waiting;
uint32_t sched_id; /* Increment everytime fiber is scheduled by event loop */
void *supervisor_channel; /* Channel to push self to when signaling. */
#endif
};