Skip to content

Commit a6151f2

Browse files
committed
Cleaned up pool thread names and added test for failing parking ops
1 parent 3158bb7 commit a6151f2

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,10 @@ to catch and handle."
463463
(#'clojure.core.async.impl.go/go-impl &env body))
464464

465465
(defonce ^:private ^Executor thread-macro-executor
466-
(Executors/newCachedThreadPool (conc/counted-thread-factory "async-thread-macro-%d" true)))
466+
(Executors/newCachedThreadPool (conc/counted-thread-factory "async-thread-%d" true)))
467467

468468
(defonce ^:private ^ExecutorService io-thread-exec
469-
(Executors/newCachedThreadPool (conc/counted-thread-factory "io-thread-macro-%d" true)))
469+
(Executors/newCachedThreadPool (conc/counted-thread-factory "async-io-thread-%d" true)))
470470

471471
(defn thread-call
472472
"Executes f in another thread, returning immediately to the calling

src/test/clojure/clojure/core/async_test.clj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,22 @@
186186
(is (<!! (thread test-dyn))))))
187187

188188
(deftest io-thread-tests
189-
(testing "io-thread"
189+
(testing "io-thread blocking ops"
190190
(let [c1 (chan)
191191
c2 (chan)
192192
c3 (chan)]
193193
(io-thread (>!! c2 (clojure.string/upper-case (<!! c1))))
194194
(io-thread (>!! c3 (clojure.string/reverse (<!! c2))))
195195
(>!! c1 "loop")
196-
(is (= "POOL" (<!! c3))))))
196+
(is (= "POOL" (<!! c3)))))
197+
(testing "io-thread parking op should fail"
198+
(let [c1 (chan)]
199+
(io-thread
200+
(try
201+
(>! c1 :no)
202+
(catch AssertionError _
203+
(>!! c1 :yes))))
204+
(is (= :yes (<!! c1))))))
197205

198206
(deftest ops-tests
199207
(testing "map<"

0 commit comments

Comments
 (0)