You should never block a go loop other than by using a parking channel op 
(like <!, >!, etc).

You probably instead want a control channel where you can send it a pause 
message telling it to block on the control channel until a resume message 
arrives.

On Thursday, September 11, 2014 6:52:48 AM UTC-5, Jeremy Vuillermet wrote:
>
> Hello,
>
> here is my use case 
>
> (defn replay [history] (go (doseq [millis history] 
>                                           (<! (timeout millis)) 
>                                           (prn millis))))
>
> history is a vector of duration: [1000 2000 4000]
>
> Now I would like to pause this doseq. One way is to use an atom pause?, 
> check for the pause and block until a new value in a "resume" chan.
>
> But there may be an other way with channels only and avoid global/shared 
> pause atom.
> I was naively thinking of a pause channel and at each loop I check if 
> there is a value but I'm not sure it's better and I couldn't manage to do 
> it anyway.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to