Clojure best way to achieve multiple threads? Clojure best way to achieve multiple threads? multithreading multithreading

Clojure best way to achieve multiple threads?


I would recommend using the pcalls function, like this:

(defn- process-server-responses []  (prn "server connected")  (. java.lang.Thread sleep 1000)  (prn "server disconnected"))(defn- process-client-input []  (prn "client-input start")  (. java.lang.Thread sleep 1000)  (prn "client-input stop"))(pcalls process-server-responses process-client-input)

Output for the above:

"server connected""client-input start""server disconnected""client-input stop"

Docs for pcalls here:

http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/pcalls