            :bufs {}           ; Keyed by buf-id, value is FifoBuffer.
            :smas {}           ; Keyed by buf-id, value is state-machine array.
            :smas-new {}       ; Like :smas, but for new, not yet run goroutines.
+           :closed {}         ; Keyed by buf-id, value is bool on chan closure.
            :logical-speed 1.0 ; Logical-speed * physical-delta = logical-delta.
            :logical-ms 0      ; Logical time/msecs, which is always updated
            :physical-ms (now) ; at the same time as physical-ms time snapshot.

    (commit [_] (when (active-cb) f))))

(defn ssa-take [state blk ^not-native c]
  (let [active? #(seqv-alive? (chan-ago-world c) (chan-seqv c))]
    (if-let [cb (protocols/take!
                 c (fn-handler
                    active?
                    (fn [x]
                      (when (active?)
                        (ioc-macros/aset-all! state ioc-helpers/VALUE-IDX
                                              x ioc-helpers/STATE-IDX blk)
                        (ioc-helpers/run-state-machine-wrapped state)))))]
      (do (ioc-macros/aset-all! state ioc-helpers/VALUE-IDX
                                @cb ioc-helpers/STATE-IDX blk)
          :recur)
      nil)))

(defn ssa-put [state blk ^not-native c val]
  (let [active? #(seqv-alive? (chan-ago-world c) (chan-seqv c))]
    (if-let [cb (protocols/put!
                 c val (fn-handler
                        active?
                        (fn [ret-val]
                          (when (active?)
                            (ioc-macros/aset-all! state ioc-helpers/VALUE-IDX
                                                  ret-val ioc-helpers/STATE-IDX blk)
                            (ioc-helpers/run-state-machine-wrapped state)))))]
      (do (ioc-macros/aset-all! state ioc-helpers/VALUE-IDX
                                @cb ioc-helpers/STATE-IDX blk)
          :recur)

            [cljs.core.async.impl.protocols :as protocols]))

(defn acopy [asrc adst & start-idx]
  (loop [idx (or (first start-idx) 0)]
    (when (< idx (alength asrc))
      (aset adst idx (aget asrc idx))
      (recur (inc idx))))
