Skip to content

Commit

Permalink
Check upstream for closing on go-car
Browse files Browse the repository at this point in the history
  • Loading branch information
ericnormand committed Dec 9, 2014
1 parent 13e4f27 commit 15f3049
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions exercises/chapter8.clj
Expand Up @@ -4,12 +4,16 @@
(go
(loop []
(let [body (<! body-chan)
wheel1 (<! wheel-chan)
bw (attach-wheel body wheel1)
wheel2 (<! wheel-chan)bww (attach-wheel bw wheel2)box (box-up bww)]
(println "Finished car")
(when (>! box-chan box)
(recur))))
wheel1 (<! wheel-chan)]
(when (and body wheel1)
(let [bw (attach-wheel body wheel1)
wheel2 (<! wheel-chan)]
(when wheel2
bww (attach-wheel bw wheel2)
box (box-up bww)
(println "Finished car")
(when (>! box-chan box)
(recur)))))))
(async/close! body-chan)
(async/close! wheel-chan)))

Expand Down

0 comments on commit 15f3049

Please sign in to comment.