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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (view) (download) (as text)

1 : monnier 2 <!-- mailbox.html -->
2 :    
3 :     <!-- COPYRIGHT (c) 1996 AT\|@AMP\|T Research. -->
4 :    
5 :     <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
6 :     <HTML>
7 :     <HEAD>
8 :     <TITLE>The Mailbox structure</TITLE>
9 :     </HEAD>
10 :     <BODY>
11 :     <H1><A NAME="top-of-document">The Concurrent ML Reference Manual</A></H1>
12 :     <HR>
13 :    
14 :     <H3>The Mailbox structure</H3>
15 :     <P>
16 :     The Mailbox structure provides buffered asynchronous channels, which we call mailboxes.
17 :     <HR>
18 :     <H4>Synopsis</H4>
19 :     <BLOCKQUOTE>
20 :     <CODE><B>signature </B><A NAME="MAILBOX:SIG:SPEC"><CODE>MAILBOX</CODE></A><BR>
21 :     <B>structure </B><A NAME="Mailbox:STR:SPEC"><CODE>Mailbox</CODE></A><B> : </B>MAILBOX<BR>
22 :     </CODE>
23 :     </BLOCKQUOTE>
24 :     <HR>
25 :     <H4>Interface</H4>
26 :     <BLOCKQUOTE>
27 :     <CODE><B>type</B> 'a <A NAME="SIG:MAILBOX.mbox:TY:SPEC" HREF="#SIG:MAILBOX.mbox:TY">mbox</A><BR>
28 :     <B>val</B> <A NAME="SIG:MAILBOX.mailbox:VAL:SPEC" HREF="#SIG:MAILBOX.mailbox:VAL">mailbox</A> <B>:</B> unit -&gt; 'a mbox <BR>
29 :     <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>
30 :     <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>
31 :     <B>val</B> <A NAME="SIG:MAILBOX.recv:VAL:SPEC" HREF="#SIG:MAILBOX.recv:VAL">recv</A> <B>:</B> 'a mbox -&gt; 'a <BR>
32 :     <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>
33 :     <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>
34 :     </CODE>
35 :     </BLOCKQUOTE>
36 :     <H4>Description</H4>
37 :     <DL>
38 :     <DT> <A NAME="SIG:MAILBOX.mbox:TY"><CODE><B>type</B> 'a mbox</CODE></A>
39 :     <DD>
40 :     This is the type constructor for a mailbox. A mailbox is an unbounded, buffered communication channel.
41 :     <BR>
42 :     <BR>
43 :    
44 :     <DT> <A NAME="SIG:MAILBOX.mailbox:VAL"><CODE>mailbox ()
45 :     </CODE></A>
46 :     <DD>
47 :     creates a new mailbox.
48 :     <BR>
49 :     <BR>
50 :    
51 :     <DT> <A NAME="SIG:MAILBOX.sameMailbox:VAL"><CODE>sameMailbox (<VAR>mb1</VAR>, <VAR>mb2</VAR>)
52 :     </CODE></A>
53 :     <DD>
54 :     returns <CODE>true</CODE>, if <VAR>mb1</VAR> and <VAR>mb2</VAR> are the same mailbox.
55 :     <BR>
56 :     <BR>
57 :    
58 :     <DT> <A NAME="SIG:MAILBOX.send:VAL"><CODE>send (<VAR>mb</VAR>, <VAR>msg</VAR>)
59 :     </CODE></A>
60 :     <DD>
61 :     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.
62 :     <BR>
63 :     <BR>
64 :    
65 :     <DT> <A NAME="SIG:MAILBOX.recv:VAL"><CODE>recv <VAR>mb</VAR>
66 :     </CODE></A>
67 :     <DD>
68 :     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.
69 :     <BR>
70 :     <BR>
71 :    
72 :     <DT> <A NAME="SIG:MAILBOX.recvEvt:VAL"><CODE>recvEvt <VAR>mb</VAR>
73 :     </CODE></A>
74 :     <DD>
75 :     returns the event value that represents the <A HREF="mailbox.html#SIG:MAILBOX.recv:VAL:SPEC">recv</A> operation on <VAR>mb</VAR>.
76 :     <BR>
77 :     <BR>
78 :    
79 :     <DT> <A NAME="SIG:MAILBOX.recvPoll:VAL"><CODE><B>val</B> recvPoll</CODE></A>
80 :     <DD>
81 :     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.
82 :     <BR>
83 :     <BR>
84 :    
85 :     </DL>
86 :     <HR>
87 :     <H4>Discussion</H4>
88 :     <P>
89 :     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.
90 :     <H4>See Also</H4>
91 :     <BLOCKQUOTE>
92 :     <A HREF="cml.html#CML:STR:SPEC">CML</A>
93 :     </BLOCKQUOTE>
94 :     <HR>
95 :     <B>[ <A HREF="index-all.html">INDEX</A> | <A HREF="mailbox.html">TOP</A>
96 :     | <A HREF="core-cml.html">Parent</A> | <A HREF="refman.html">Root</A>
97 :     ]</B>
98 :     <P>
99 :     <I>Last Modified April 21, 1996</I><BR>
100 :     Copyright &copy; 1996 AT&amp;T <BR>
101 :     <HR>
102 :     </BODY>
103 :     </HTML>

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