Skip to content

Instantly share code, notes, and snippets.

@noisesmith
Last active January 8, 2016 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save noisesmith/d2b488f3f99dfb6ec524 to your computer and use it in GitHub Desktop.
Save noisesmith/d2b488f3f99dfb6ec524 to your computer and use it in GitHub Desktop.
experiment with closing and putting in core.async
(require '[clojure.core.async :refer [>! <! chan go timeout]])
(defn test-closers
[buffer delay]
(let [ch (chan buffer)]
(go (>! ch 1)
(println 1)
(>! ch 2)
(println :done))
(go (<! ch)
(when delay
(<! (timeout delay))
(println "waited" delay))
(close! ch)))
nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment