Home

missionary.core/mbx

Usage

Description

A port constructor defining an unbounded, non-blocking FIFO mailbox. A mailbox is initially empty, then messages can be enqueued synchronously. Dequeuing is an asynchronous effect completing with the oldest message when the mailbox has some.

Examples

(require '[missionary.core :as m])

(def m (m/mbx))

(def main (m/sp (prn :> (m/? m) (m/? m) (m/? m))))

(def ps (main #(prn :success %) #(prn :failure %)))
(m :foo)
(m :bar)
(m :baz)
:> :foo :bar :baz
:success nil

Synchronicity