Skip to content

Instantly share code, notes, and snippets.

@karolinepauls
Created February 1, 2022 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karolinepauls/9c976d95950141bc3b7d8b179b65b1c4 to your computer and use it in GitHub Desktop.
Save karolinepauls/9c976d95950141bc3b7d8b179b65b1c4 to your computer and use it in GitHub Desktop.
(def ^:dynamic *some-context* nil)
(tap> "start")
(defn inspect []
(tap>
(format "tap: thread=%s context=%s"
(.getId (Thread/currentThread))
*some-context*)))
(binding [*some-context* "in the agent"]
(future (inspect)))
(.submit clojure.lang.Agent/soloExecutor inspect)
; "start"
; "tap: thread=498 context=in the agent"
; "tap: thread=498 context=in the agent"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment