Skip to content

Commit e9bb61d

Browse files
committed
pipeline, block thread only during task duration
Right now pipeline would block on channel consumption that means that even when the pipeline has nothing to do we block/use threads for nothing. This patch makes it so that we call (async/thread f) only for the duration of the task and let the chan consumption happen in a go block.
1 parent 472340f commit e9bb61d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/clojure/clojure/core/async.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ to catch and handle."
544544
true)))]
545545
(dotimes [_ n]
546546
(case type
547-
(:blocking :compute) (thread
548-
(let [job (<!! jobs)]
549-
(when (process job)
547+
(:blocking :compute) (go-loop []
548+
(let [job (<! jobs)]
549+
(when (<! (thread (process job)))
550550
(recur))))
551551
:async (go-loop []
552552
(let [job (<! jobs)]

0 commit comments

Comments
 (0)