Skip to content

Instantly share code, notes, and snippets.

@lbradstreet
Created July 20, 2015 16:04
Show Gist options
  • Save lbradstreet/5bc46b7f46990eef3627 to your computer and use it in GitHub Desktop.
Save lbradstreet/5bc46b7f46990eef3627 to your computer and use it in GitHub Desktop.
user=> (let [ch (chan 5)
#_=> _ (>!! ch :a)
#_=> _ (>!! ch :b)
#_=> tm (timeout 3000)]
#_=> (println (System/currentTimeMillis))
#_=> (println (alts!! [ch tm]))
#_=> (println (alts!! [ch tm]))
#_=> (println (alts!! [ch tm]))
#_=> (println (System/currentTimeMillis)))
1437408244803
[:a #object[clojure.core.async.impl.channels.ManyToManyChannel 0x3f9aac83 clojure.core.async.impl.channels.ManyToManyChannel@3f9aac83]]
[:b #object[clojure.core.async.impl.channels.ManyToManyChannel 0x3f9aac83 clojure.core.async.impl.channels.ManyToManyChannel@3f9aac83]]
[nil #object[clojure.core.async.impl.channels.ManyToManyChannel 0x410e6288 clojure.core.async.impl.channels.ManyToManyChannel@410e6288]]
1437408247807
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment