1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-01 16:13:02 +00:00

Add JANET_ASYNC_EVENT_CANCEL

also fix bug that could cause event loop to hang.
This commit is contained in:
Calvin Rose
2020-11-16 18:46:59 -06:00
parent f9d0eb47b7
commit cff52ded58
3 changed files with 18 additions and 4 deletions

View File

@@ -65,4 +65,13 @@
(ev/close writer)
(ev/take chan))
(var result nil)
(def fiber
(ev/spawn
(set result (protect (ev/sleep 0.4)))
(assert (= result '(false "boop")) "ev/cancel 1")))
(ev/sleep 0.1)
(ev/cancel fiber "boop")
(ev/sleep 0.1)
(end-suite)