Skip to content

Instantly share code, notes, and snippets.

@ciniglio
Created November 28, 2014 00:38
Show Gist options
  • Save ciniglio/4b0636aed59087323d3f to your computer and use it in GitHub Desktop.
Save ciniglio/4b0636aed59087323d3f to your computer and use it in GitHub Desktop.
Unordered pipeline
(def from-chan)
(def to-chan)
(dotimes [_ num-threads]
(let [rf (fn [_ x] (>!! to-chan))
f (xform rf)]
(thread
(loop []
(when-some [x (<!! from-chan)]
(f x))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment