Guest User

Untitled

a guest
Jun 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. (import '(java.util.concurrent LinkedBlockingQueue TimeUnit))
  2.  
  3. (def q (LinkedBlockingQueue. 5))
  4.  
  5. (future (while true
  6. (println (str "took " (.take q)))
  7. (Thread/sleep 500))) ; simulate slow IO
  8.  
  9. (doseq [x (range 10)]
  10. (println (str "offering " x))
  11. (.offer q x 100 TimeUnit/SECONDS))
Add Comment
Please, Sign In to add comment