-(ns hellhound.async)
-(:require
- [clojure.core.async.impl.ioc-macros :as ioc]
- ;; TODO Replace tp with our own implementation.
- [clojure.core.async.impl.exec.threadpool :as tp]
- [hellhound.async.dispatch :as dispatch])
+(ns hellhound.async
+  (:require
+   [clojure.core.async.impl.ioc-macros :as ioc]
+   ;; TODO Replace tp with our own implementation.
+   [clojure.core.async.impl.exec.threadpool :as tp]
+   ;; TODO: Remove the async requirement here
+   [clojure.core.async :refer [chan <!]]
+   [hellhound.async.dispatch :as dispatch]))
 
-(defonce executor (tp/thread-pool-executor))
+(def executor1 (delay (tp/thread-pool-executor)))
 
 (defmacro go-block
   "Asynchronously executes the given `body` in a thread pool dedicated

                           (ioc/aset-all! ioc/USER-START-IDX c#
                                          ioc/BINDINGS-IDX captured-bindings#))]
            (ioc/run-state-machine-wrapped state#)))
         executor)
       c#)))

  completed."
  [& body]
  (let [crossing-env (zipmap (keys &env) (repeatedly gensym))]
    (println "xxxxxxxxxxxxxxxxxxx")
    (clojure.pprint/pprint crossing-env)
    `(let [c# (chan 1)
           captured-bindings# (clojure.lang.Var/getThreadBindingFrame)]

       (println "yyyyyyyyyyy")
       (dispatch/run
         (^:once fn* []
          (let [~@(mapcat (fn [[l sym]] [sym `(^:once fn* [] ~(vary-meta l dissoc :tag))]) crossing-env)
