File tree 2 files changed +4
-20
lines changed
src/main/clojure/clojure/core
2 files changed +4
-20
lines changed Original file line number Diff line number Diff line change 9
9
(ns clojure.core.async
10
10
" Facilities for async programming and communication.
11
11
12
- go blocks are dispatched over an internal thread pool, which
13
- defaults to 8 threads. The size of this pool can be modified using
14
- the Java system property `clojure.core.async.pool-size`.
15
-
16
12
Set Java system property `clojure.core.async.go-checking` to true
17
13
to validate go blocks do not invoke core.async blocking operations.
18
14
Property is read once, at namespace load time. Recommended for use
@@ -58,9 +54,8 @@ return nil for unexpected contexts."
58
54
)
59
55
(:import [java.util.concurrent.atomic AtomicLong]
60
56
[java.util.concurrent.locks Lock]
61
- [java.util.concurrent Executors Executor ThreadLocalRandom]
62
- [java.util Arrays ArrayList]
63
- [clojure.lang Var]))
57
+ [java.util.concurrent ThreadLocalRandom]
58
+ [java.util Arrays ArrayList]))
64
59
65
60
(alias 'core 'clojure.core)
66
61
Original file line number Diff line number Diff line change 8
8
9
9
(ns ^{:skip-wiki true }
10
10
clojure.core.async.impl.dispatch
11
- (:require [clojure.core.async.impl.protocols :as impl])
12
11
(:import [java.util.concurrent Executors ExecutorService ThreadFactory]))
13
12
14
13
(set! *warn-on-reflection* true )
36
35
(.setName (format name-format (swap! counter inc)))
37
36
(.setDaemon daemon))))))))
38
37
39
- (defonce
40
- ^{:doc " Number of processors reported by the JVM" }
41
- processors (.availableProcessors (Runtime/getRuntime )))
42
-
43
- (def ^:private pool-size
44
- " Value is set via clojure.core.async.pool-size system property; defaults to 8; uses a
45
- delay so property can be set from code after core.async namespace is loaded but before
46
- any use of the async thread pool."
47
- (delay (or (Long/getLong " clojure.core.async.pool-size" ) 8 )))
48
-
49
38
; ; used only for implementing go-checking
50
39
(def ^:private ^:dynamic *in-go-dispatch* false )
51
40
69
58
nil )
70
59
71
60
(defn- make-ctp-named
72
- [workflow ]
73
- (Executors/newCachedThreadPool (counted-thread-factory (str " async-" (name workflow ) " -%d" ) true )))
61
+ [workload ]
62
+ (Executors/newCachedThreadPool (counted-thread-factory (str " async-" (name workload ) " -%d" ) true )))
74
63
75
64
(defn ^:private create-default-executor
76
65
[workload]
You can’t perform that action at this time.
0 commit comments