Skip to content

Instantly share code, notes, and snippets.

@Chouser Chouser/gist:654062
Created Oct 29, 2010

What would you like to do?
(import '(java.util.concurrent LinkedBlockingQueue TimeUnit))
(def q (LinkedBlockingQueue. 5))
(future (while true
(println (str "took " (.take q)))
(Thread/sleep 500))) ; simulate slow IO
(doseq [x (range 10)]
(println (str "offering " x))
(.offer q x 100 TimeUnit/SECONDS))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.