processes use virtual threads

This commit is contained in:
Scott Richmond 2023-01-28 17:18:09 -05:00
parent 6169f4f462
commit b7f0d17afe
2 changed files with 12 additions and 1 deletions

View File

@ -9,4 +9,5 @@
:repl-options {:init-ns ludus.core}
:main ludus.core
:profiles {:uberjar {:aot :all}}
:jvm-opts ["--enable-preview"]
)

View File

@ -1,6 +1,16 @@
(ns ludus.process
(:require
[ludus.data :as data]))
[ludus.data :as data])
(:import (java.util.concurrent Executors)))
(defn thread-factory [name]
(-> (Thread/ofVirtual)
(.name name 0)
(.factory)))
(set-agent-send-off-executor!
(Executors/newThreadPerTaskExecutor
(thread-factory "ludus-vthread-")))
(def processes (atom {}))