The Mailbox structure provides buffered asynchronous channels, which we call mailboxes.
signature MAILBOX
structure Mailbox
: MAILBOX
type 'a mbox
val mailbox : unit -> 'a mbox
val sameMailbox : ('a mbox * 'a mbox) -> bool
val send : ('a mbox * 'a) -> unit
val recv : 'a mbox -> 'a
val recvEvt : 'a mbox -> 'a event
val recvPoll : 'a mbox -> 'a option
type 'a mbox
mailbox ()
sameMailbox (mb1, mb2)
true
, if mb1 and mb2 are the same mailbox.
send (mb, msg)
recv mb
recvEvt mb
val recvPoll
Note that mailbox buffers are unbounded, which means that there is no flow control to prevent a producer from greatly outstriping a consumer, and thus exhausting memory. In situations where there is no natural limit to the rate of send operations, it is recommended that the synchronous channels from the CML structure be used instead.
CML
Last Modified April 21, 1996
Comments to John Reppy.
Copyright © 1997 Bell Labs, Lucent Technologies