signature MAILBOX
structure Mailbox
: MAILBOX
The Mailbox structure provides buffered asynchronous channels, which we call mailboxes.
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
CML
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.
Last Modified &date;
Comments to John Reppy.
Copyright © 1998 Bell Labs, Lucent Technologies