Closed amano-kenji closed 4 months ago
It seems that once I call ev/select
on channels, those channels become unuseable with ev/take
or ev/give
.
My suspicion is that janet_chan_unlock
is not called for all the given channels once a channel is closed, receives a value, or gives a value.
It seems that once I call ev/select on channels, those channels become unuseable with ev/take or ev/give.
That seems like a separate issue, but also seems incorrect. For example:
(def c (ev/chan 10))
(def d (ev/chan 10))
(ev/spawn
(forever
(match (ev/select c d)
[:close x]
(print "channel " x " closed")
[:take x y]
(print "got " y " from " x))))
(forever
(ev/sleep 1)
(if (> (math/random) 0.5)
(ev/give c :item)
(ev/give d :item)))
this works for me
I'll come back to this tomorrow.
I just tested the latest commit. This issue is fixed, but I may discover more issues with ev/select
soon.
ev/select
tries to resume the second task that errored out becausech1
is closed later in another task.ev/select
should not revive a dead task.ev/select
effectively turns a task into an undead task. I don't like zombies.