File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 48
48
49
49
When doing a pmap, Claypoole pushes input tasks into the threadpool. It
50
50
normally tries to keep the threadpool full, plus it adds a buffer of size
51
- nthreads. If it can't find out the number of thread in the threadpool, it
51
+ nthreads. If it can't find out the number of threads in the threadpool, it
52
52
just tries to keep *default-pmap-buffer* tasks in the pool."
53
53
200 )
54
54
278
278
`(future-call ~pool (^{:once true } fn future-body [] ~@body)))
279
279
280
280
(defn- make-canceller
281
- " Creates a function to cancel a bunch of futures ."
282
- [future-reader ]
281
+ " Creates a function to cancel a pmap ."
282
+ [driver ]
283
283
(let [first-already-cancelled (atom Long/MAX_VALUE)]
284
284
(fn [i later-tasks]
285
285
(let [cancel-end @first-already-cancelled]
286
286
; ; Don't re-kill futures we've already zapped to prevent an O(n^2)
287
287
; ; explosion.
288
288
(when (< i cancel-end)
289
289
(swap! first-already-cancelled min i)
290
- ; ; Kill the future reader .
291
- (future-cancel future-reader )
290
+ ; ; Kill the pmap driver thread .
291
+ (future-cancel driver )
292
292
; ; Stop the tasks above i before cancel-end.
293
293
(doseq [f (->> later-tasks rest (take (- cancel-end i)))]
294
294
(future-cancel f)))))))
Original file line number Diff line number Diff line change 229
229
nil ))
230
230
231
231
; ; Queue-seq needs a unique item that, when seen in a queue, indicates that the
232
- ; ; sequence has ended. It uses this private object, and uses identical? to
233
- ; ; check against this object's (unique) memory address.
232
+ ; ; sequence has ended. It uses the private object end-marker , and uses
233
+ ; ; identical? to check against this object's (unique) memory address.
234
234
(let [end-marker (Object. )]
235
235
236
236
(defn- queue-reader
You can’t perform that action at this time.
0 commit comments