Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/cml/doc/HTML/mailbox.html
ViewVC logotype

View of /sml/trunk/src/cml/doc/HTML/mailbox.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (download) (as text) (annotate)
Sat Oct 4 23:33:09 1997 UTC (21 years, 9 months ago) by monnier
File size: 4151 byte(s)
Initial revision
<!-- mailbox.html -->

<!-- COPYRIGHT (c) 1996 AT\|@AMP\|T Research. -->

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>The Mailbox structure</TITLE>
</HEAD>
<BODY>
<H1><A NAME="top-of-document">The Concurrent ML Reference Manual</A></H1>
<HR>

<H3>The Mailbox structure</H3>
<P>
The Mailbox structure provides buffered asynchronous channels, which we call mailboxes. 
<HR>
<H4>Synopsis</H4>
<BLOCKQUOTE>
<CODE><B>signature </B><A NAME="MAILBOX:SIG:SPEC"><CODE>MAILBOX</CODE></A><BR>
<B>structure </B><A NAME="Mailbox:STR:SPEC"><CODE>Mailbox</CODE></A><B> : </B>MAILBOX<BR>
</CODE>
</BLOCKQUOTE>
<HR>
<H4>Interface</H4>
<BLOCKQUOTE>
<CODE><B>type</B> 'a <A NAME="SIG:MAILBOX.mbox:TY:SPEC" HREF="#SIG:MAILBOX.mbox:TY">mbox</A><BR>
<B>val</B> <A NAME="SIG:MAILBOX.mailbox:VAL:SPEC" HREF="#SIG:MAILBOX.mailbox:VAL">mailbox</A> <B>:</B> unit -&gt; 'a mbox       <BR>
<B>val</B> <A NAME="SIG:MAILBOX.sameMailbox:VAL:SPEC" HREF="#SIG:MAILBOX.sameMailbox:VAL">sameMailbox</A> <B>:</B> ('a mbox * 'a mbox) -&gt; bool       <BR>
<B>val</B> <A NAME="SIG:MAILBOX.send:VAL:SPEC" HREF="#SIG:MAILBOX.send:VAL">send</A> <B>:</B> ('a mbox * 'a) -&gt; unit       <BR>
<B>val</B> <A NAME="SIG:MAILBOX.recv:VAL:SPEC" HREF="#SIG:MAILBOX.recv:VAL">recv</A> <B>:</B> 'a mbox -&gt; 'a       <BR>
<B>val</B> <A NAME="SIG:MAILBOX.recvEvt:VAL:SPEC" HREF="#SIG:MAILBOX.recvEvt:VAL">recvEvt</A> <B>:</B> 'a mbox -&gt; 'a event       <BR>
<B>val</B> <A NAME="SIG:MAILBOX.recvPoll:VAL:SPEC" HREF="#SIG:MAILBOX.recvPoll:VAL">recvPoll</A> <B>:</B> 'a mbox -&gt; 'a option       <BR>
</CODE>
</BLOCKQUOTE>
<H4>Description</H4>
<DL>
<DT> <A NAME="SIG:MAILBOX.mbox:TY"><CODE><B>type</B> 'a mbox</CODE></A>
<DD>
This is the type constructor for a mailbox. 	A mailbox is an unbounded, buffered communication channel.     
<BR>
<BR>

<DT> <A NAME="SIG:MAILBOX.mailbox:VAL"><CODE>mailbox ()
        </CODE></A>
<DD>
creates a new mailbox.     
<BR>
<BR>

<DT> <A NAME="SIG:MAILBOX.sameMailbox:VAL"><CODE>sameMailbox (<VAR>mb1</VAR>, <VAR>mb2</VAR>)
        </CODE></A>
<DD>
returns <CODE>true</CODE>, if <VAR>mb1</VAR> and <VAR>mb2</VAR> are the same mailbox.     
<BR>
<BR>

<DT> <A NAME="SIG:MAILBOX.send:VAL"><CODE>send (<VAR>mb</VAR>, <VAR>msg</VAR>)
        </CODE></A>
<DD>
sends the message <VAR>msg</VAR> to the mailbox <VAR>mb</VAR>. 	Note that unlike <A HREF="cml.html#SIG:CML.send:VAL:SPEC">CML.send</A>, this is a non-blocking 	operation.     
<BR>
<BR>

<DT> <A NAME="SIG:MAILBOX.recv:VAL"><CODE>recv <VAR>mb</VAR>
        </CODE></A>
<DD>
receive the next message from the mailbox <VAR>mb</VAR>. 	If, the mailbox is empty, then this blocks the calling 	thread until there is a message available.     
<BR>
<BR>

<DT> <A NAME="SIG:MAILBOX.recvEvt:VAL"><CODE>recvEvt <VAR>mb</VAR>
        </CODE></A>
<DD>
returns the event value that represents the <A HREF="mailbox.html#SIG:MAILBOX.recv:VAL:SPEC">recv</A> operation 	on <VAR>mb</VAR>.     
<BR>
<BR>

<DT> <A NAME="SIG:MAILBOX.recvPoll:VAL"><CODE><B>val</B> recvPoll</CODE></A>
<DD>
This is the non-blocking version of <A HREF="mailbox.html#SIG:MAILBOX.recv:VAL:SPEC">recv</A>. 	If the corresponding blocking form would block (because the mailbox is 	empty), then this returns 	NONE, otherwise it returns 	SOME of the received 	message.     
<BR>
<BR>

</DL>
<HR>
<H4>Discussion</H4>
<P>
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       <A HREF="mailbox.html#SIG:MAILBOX.send:VAL:SPEC">send</A> operations, it is recommended that the       synchronous channels from the <A HREF="cml.html#CML:STR:SPEC">CML</A> structure       be used instead.     
<H4>See Also</H4>
<BLOCKQUOTE>
<A HREF="cml.html#CML:STR:SPEC">CML</A>
</BLOCKQUOTE>
<HR>
<B>[ <A HREF="index-all.html">INDEX</A> | <A HREF="mailbox.html">TOP</A>
   | <A HREF="core-cml.html">Parent</A> | <A HREF="refman.html">Root</A>
   ]</B>
<P>
<I>Last Modified April 21, 1996</I><BR>
Copyright &copy; 1996 AT&amp;T <BR>
<HR>
</BODY>
</HTML>

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0