any idea why a thread/go-block that’s blocked/parked on a channel does not resume when we close that channel (channel closing happens after it’s already blocked/parked) e.g.
(def c (chan))
(future
(alt!!
[[c "value"]] :done))
(close! c) ;; expected alt!! to return since all its clauses are never going to succeed now
I use this for these cases to ensure the channels are not blocking anything when they're closed
(defn drain! [ch]
(a/close! ch)
(->> (repeatedly #(a/poll! ch))
(take-while identity)
doall))
did think of this. i might as well proceed with this for now and think of a clean strategy later
ok nevermind. understood. the expectations with writes is that someone may want to read it
and once all reads have happened the thread/goroutine will unblock
There are some bugs open for this