Skip to content

Commit

Permalink
Tweaking docstring and using custom ExecutorService for io-threads
Browse files Browse the repository at this point in the history
  • Loading branch information
fogus committed Jan 23, 2025
1 parent 4df69ea commit e477c08
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/clojure/clojure/core/async.clj
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,16 @@ to catch and handle."
(defonce ^:private ^Executor thread-macro-executor
(Executors/newCachedThreadPool (conc/counted-thread-factory "async-thread-macro-%d" true)))

(defonce ^:private ^ExecutorService io-thread-exec thread-macro-executor)
(defonce ^:private ^ExecutorService io-thread-exec
(Executors/newCachedThreadPool (conc/counted-thread-factory "io-thread-macro-%d" true)))

(defmacro io-thread
"Asynchronously executes the body in a thread compatible with I/O workload,
returning immediately to the calling thread. Only blocking operations should
be used in io-thread bodies.
io-thread blocks should not (either directly or indirectly) perform operations
that never block and run pure compute operations. Parking ops
io-thread bodies should not (either directly or indirectly) perform operations
that never block nor run pure compute operations. Parking ops
(i.e. <!, >! and alt!/alts!) used in io-thread bodies will throw at
runtime.
Expand Down

0 comments on commit e477c08

Please sign in to comment.