From 0ca502640d822cea73853ccef18a39f8a29c4ac1 Mon Sep 17 00:00:00 2001 From: Fogus Date: Mon, 27 Jan 2025 20:50:51 -0500 Subject: [PATCH] no more best-fit- prefix --- src/main/clojure/clojure/core/async.clj | 18 +++++++++--------- .../clojure/core/async/impl/exec/services.clj | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/clojure/clojure/core/async.clj b/src/main/clojure/clojure/core/async.clj index f868527..5a40364 100644 --- a/src/main/clojure/clojure/core/async.clj +++ b/src/main/clojure/clojure/core/async.clj @@ -468,15 +468,7 @@ to catch and handle." thread. Returns a channel which will receive the result of calling f when completed, then close." [f] - (exec-services/best-fit-thread-call f :mixed)) - -(defmacro io-thread - "Executes the body in a thread intended for blocking I/O workloads, - returning immediately to the calling thread. The body must not do - extended computation (if so, use 'thread' instead). Returns a channel - which will receive the result of the body when completed, then close." - [& body] - `(exec-services/best-fit-thread-call (^:once fn* [] ~@body) :io)) + (exec-services/thread-call f :mixed)) (defmacro thread "Executes the body in another thread, returning immediately to the @@ -485,6 +477,14 @@ to catch and handle." [& body] `(thread-call (^:once fn* [] ~@body))) +(defmacro io-thread + "Executes the body in a thread intended for blocking I/O workloads, + returning immediately to the calling thread. The body must not do + extended computation (if so, use 'thread' instead). Returns a channel + which will receive the result of the body when completed, then close." + [& body] + `(exec-services/thread-call (^:once fn* [] ~@body) :io)) + ;;;;;;;;;;;;;;;;;;;; ops ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defmacro go-loop diff --git a/src/main/clojure/clojure/core/async/impl/exec/services.clj b/src/main/clojure/clojure/core/async/impl/exec/services.clj index 6a3a633..0f96514 100644 --- a/src/main/clojure/clojure/core/async/impl/exec/services.clj +++ b/src/main/clojure/clojure/core/async/impl/exec/services.clj @@ -22,7 +22,7 @@ (defonce ^ExecutorService compute-executor (Executors/newCachedThreadPool (conc/counted-thread-factory "async-compute-%d" true))) -(defn best-fit-thread-call +(defn thread-call [f exec] (let [c (clojure.core.async/chan 1) ^ExecutorService e (case exec