      (deref (p/finally d (fn [_ _] (p/cancel! t)))))))
 
 (defn alts!
+  "Completes at most one of several operations on channel. Receives a
+  vector of operations and optional keyword options.
+
+  A channel operation is defined as a vector of 2 elements for take,
+  and 3 elements for put. Unless the :priority option is true and if
+  more than one channel operation is ready, a non-deterministic choice
+  will be made.
+
+  Returns a promise instance that will be resolved when a single
+  operation is ready to a vector [val channel] where val is return
+  value of the operation and channel identifies the channel where the
+  the operation is succeeded."
   [ports & {:keys [priority]}]
   (let [ret     (p/deferred)
         lock    (channel/promise->handler ret)

    ret))

(defn close!
  [port]
  (pt/-close! port)
  nil)

(defn closed?
  [port]
  (pt/-closed? port))

(defn timeout
  [ms]
  (let [ch (chan)]
    (px/schedule! ms #(pt/-close! ch))
    ch))

(defn slidding-buffer
  [n]
  (buffers/slidding n))

(defn dropping-buffer
  [n]
  (buffers/dropping n))

(defn fixed-buffer
  [n]
  (buffers/fixed n))

(defn offer!
  [port val]
  (let [o (volatile! nil)]
    (pt/-put! port val (channel/volatile->handler o))
    @o))

(defn poll!
  [port]
  (let [o (volatile! nil)]
    (pt/-take! port (channel/volatile->handler o))
    @o))

(defn pipe
  ([from to] (pipe from to true))
  ([from to close?]
   (go-loop []
     (let [v (<! from)]
       (if (nil? v)
         (when close? (close! to))
         (when (>! to v)
           (recur)))))
   to))

(defn onto-chan!
  ([ch coll] (onto-chan! ch coll true))
  ([ch coll close?]
   (go-loop [items (seq coll)]
     (if (and items (>! ch (first items)))
       (recur (next items))
       (when close?
         (close! ch))))))

  targeted to the JVM, where you will be able to take advantage of
  virtual threads and seamless blocking operations on channels.

  **EXPERIMENTAL API**"

  (:require
   [promesa.core :as p]
