1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-13 03:58:06 +00:00

Add timeouts to net functions.

Further debugging of the general timeout system, as well
as having a single fiber wait on multiple state machines (select).
This commit is contained in:
Calvin Rose
2020-07-19 19:41:12 -05:00
parent df145f4bc9
commit 553b4d9428
9 changed files with 66 additions and 36 deletions

View File

@@ -1218,6 +1218,10 @@ JANET_API JanetListenerState *janet_listen(JanetPollable *pollable, JanetListene
/* Shorthand for yielding to event loop in C */
JANET_NO_RETURN JANET_API void janet_await(void);
/* Cancel a waiting fiber. Will notify the canceled state machines, but will not
* unwind the fiber. */
void janet_cancel(JanetFiber *fiber);
/* For use inside listeners - adds a timeout to the current fiber, such that
* it will be resumed after sec seconds if no other event schedules the current fiber. */
void janet_addtimeout(double sec);