Starting multiple threads

/ Published in: Clojure
Save to your folder(s)

Creates number of threads (specified by 'threads-number') running fn-name function. This is possible, because every Clojure function implements Runnable interface.

Copy this code and paste it in your HTML
  1. (doall (take threads-number (repeatedly #(doto (Thread. fn-name) (.start)))))

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.