Hi,

What's the correct syntax for this code -- from clojure manual.
(import '(java.util.concurrent Executors))
(defn test‐stm [nitems nthreads niters]
(let [refs (map ref (replicate nitems 0))
pool (. Executors (newFixedThreadPool nthreads))
tasks (map (fn [t]
(fn []
(dotimes n niters
(dosync
(doseq r refs
(alter r + 1 t))))))
(range nthreads))]
(doseq future (. pool (invokeAll tasks))
(. future (get)))
(. pool (shutdown))
(map deref refs)))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to