Question

all to often when I'm using core.async from the repl a go block will get away from me because I loose the channel that is used to stop it because I reload a namespace. For instance if i run this from the repl:

(go (when (not= c (second (async/alts! [c (async/timeout 1000)]))) 
      (println "hello")))

and then I reload the namespace and c is lost. Now I have "hello" spamming my REPL until the end of time. If I could close all channels or kill all go blocks it would save me restarting my REPL.

Was it helpful?

Solution

There is no way to do this globally that I know of. One technique is to use a control channel that can be used to shut down any loop. The pub/sub stuff might work well for a global control channel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top