Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | (* multicast.sig |
2 | * 2004 Matthew Fluet (mfluet@acm.org) | |
3 | * Ported to MLton threads. | |
4 | *) | |
5 | ||
6 | (* multicast-sig.sml | |
7 | * | |
8 | * COPYRIGHT (c) 1990 by John H. Reppy. See COPYRIGHT file for details. | |
9 | * | |
10 | * Asynchronous multicast (one-to-many) channels. | |
11 | *) | |
12 | ||
13 | signature MULTICAST = | |
14 | sig | |
15 | type 'a mchan | |
16 | type 'a port | |
17 | type 'a event = 'a CML.event | |
18 | ||
19 | (* create a new multicast channel *) | |
20 | val mChannel : unit -> 'a mchan | |
21 | (* create a new output port on a channel *) | |
22 | val port : 'a mchan -> 'a port | |
23 | (* create a new output port on a channel that has the same state as the | |
24 | * given port. I.e., the stream of messages seen on the two ports will | |
25 | * be the same. | |
26 | * NOTE: if two (or more) independent threads are reading from the | |
27 | * same port, then the copy operation may not be accurate. | |
28 | *) | |
29 | val copy : 'a port -> 'a port | |
30 | (* receive a message from a port *) | |
31 | val recv : 'a port -> 'a | |
32 | val recvEvt : 'a port -> 'a event | |
33 | (* send a message to all of the ports of a channel *) | |
34 | val multicast : ('a mchan * 'a) -> unit | |
35 | end |