Skip to content

Commit fe9dd81

Browse files
committed
Implement clojure.core.async function thread-call and macro thread
1 parent da07d1c commit fe9dd81

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/clojure/clojure/core/async.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,26 +355,26 @@
355355
(ioc/run-state-machine state#))))
356356
c#))
357357

358-
#_(defonce ^:private ^Executor thread-macro-executor
358+
#_(defonce ^:private ^Executor thread-macro-executor ;;; readlly we don't need this
359359
(Executors/newCachedThreadPool (conc/counted-thread-factory "async-thread-macro-%d" true)))
360360

361-
#_(defn thread-call
361+
(defn thread-call
362362
"Executes f in another thread, returning immediately to the calling
363363
thread. Returns a channel which will receive the result of calling
364364
f when completed."
365365
[f]
366366
(let [c (chan 1)]
367-
(.execute thread-macro-executor
368-
(fn []
367+
(System.Threading.Tasks.Task/Run ;;; .execute thread-macro-executor
368+
(gen-delegate System.Action [] ;;; fn []
369369
(let [ret (try (f)
370-
(catch Throwable t
370+
(catch Exception t ;;; Throwable
371371
nil))]
372372
(when-not (nil? ret)
373373
(>!! c ret))
374374
(close! c))))
375375
c))
376376

377-
#_(defmacro thread
377+
(defmacro thread
378378
"Executes the body in another thread, returning immediately to the
379379
calling thread. Returns a channel which will receive the result of
380380
the body when completed."

0 commit comments

Comments
 (0)