@@ -915,8 +915,9 @@ The special symbols are:
915
915
@tab @code {) }
916
916
@item @code {= }
917
917
@tab @code {<- }
918
+ @tab @code {<-> }
918
919
@tab @code {<| }
919
- @tab @code {<+ }
920
+ @tab @code {|> }
920
921
@tab @code {-> }
921
922
@item @code {+ }
922
923
@tab @code {++ }
@@ -1464,21 +1465,20 @@ Each port and channel can carry only one type of message. The message type is
1464
1465
encoded as a parameter of the channel or port type. The message type of a
1465
1466
channel is equal to the message type of the port it is bound to.
1466
1467
1467
- Messages are sent asynchronously or semi-synchronously. A channel contains a
1468
- message queue and asynchronously sending a message merely inserts it into the
1469
- sending channel's queue; message receipt is the responsibility of the
1470
- receiving task.
1468
+ Messages are generally sent asynchronously, with optional rate-limiting on the
1469
+ transmit side. A channel contains a message queue and asynchronously sending a
1470
+ message merely inserts it into the sending channel's queue; message receipt is
1471
+ the responsibility of the receiving task.
1471
1472
1472
1473
Queued messages in channels are charged to the domain of the @emph {sending }
1473
1474
task. If too many messages are queued for transmission from a single sending
1474
1475
task, without being received by a receiving task, the sending task may exceed
1475
1476
its memory budget, which causes a run-time signal. To help control this
1476
1477
possibility, a semi-synchronous send operation is possible, which blocks until
1477
- there is room in the existing queue and then executes an asynchronous send.
1478
+ there is room in the existing queue before sending send.
1478
1479
1479
- The asynchronous message-send operator is @code {<+ }. The semi-synchronous
1480
- message-send operator is @code {<| }. @xref {Ref.Expr.Send }. The message-receive
1481
- operator is @code {<- }. @xref {Ref.Expr.Recv }.
1480
+ The message-send operator is @code {<| }. @xref {Ref.Expr.Send }. The
1481
+ message-receive operator is @code {|> }. @xref {Ref.Expr.Recv }.
1482
1482
1483
1483
@node Ref.Task.Life
1484
1484
@subsection Ref.Task.Life
@@ -2344,7 +2344,7 @@ An example of a @code{port} type:
2344
2344
type port[vec[str]] svp;
2345
2345
let p: svp = get_port();
2346
2346
let v: vec[str];
2347
- v <- p ;
2347
+ p |> v ;
2348
2348
@end example
2349
2349
2350
2350
@node Ref.Type.Chan
@@ -2948,7 +2948,7 @@ let out: port[u8];
2948
2948
let p: task = spawn helper(chan(out));
2949
2949
let p2: task = spawn "my_helper" helper(chan(out));
2950
2950
// let task run, do other things.
2951
- let result <- out ;
2951
+ let out |> result ;
2952
2952
2953
2953
@end example
2954
2954
@@ -2958,27 +2958,11 @@ let result <- out;
2958
2958
@cindex Send expression
2959
2959
@cindex Communication
2960
2960
2961
- Sending a value through a channel can be done via two different expressions.
2962
- Both expressions take an @emph {lval }, denoting a channel, and a value to send
2963
- into the channel. The action of @emph {sending } varies depending on the
2964
- @dfn {send operator } employed.
2961
+ Sending a value into a channel is done by the send operator @code {<| }, which
2962
+ takes a channel and a value to send, and moves the value into the channel's
2963
+ outgoing buffer.
2965
2964
2966
- The @emph {asynchronous send } operator @code {<+ } adds a value to the channel's
2967
- queue, without blocking. If the queue is full, it is extended, taking memory
2968
- from the task's domain. If the task memory budget is exhausted, a signal is
2969
- sent to the task.
2970
-
2971
- The @emph {semi-synchronous send } operator @code {<| } adds a value to the
2972
- channel's queue @emph {only if } the queue has room; if the queue is full, the
2973
- operation @emph {blocks } the sender until the queue has room.
2974
-
2975
- An example of an asynchronous send:
2976
- @example
2977
- chan[str] c = @dots {};
2978
- c <+ "hello, world";
2979
- @end example
2980
-
2981
- An example of a semi-synchronous send:
2965
+ An example of a send:
2982
2966
@example
2983
2967
chan[str] c = @dots {};
2984
2968
c <| "hello, world";
@@ -2992,7 +2976,7 @@ c <| "hello, world";
2992
2976
2993
2977
The @dfn {receive expression } takes an @var {lval } to receive into and an
2994
2978
expression denoting a port, and applies the @emph {receive operator }
2995
- (@code {<- }) to the pair, copying a value out of the port and into the
2979
+ (@code {|> }) to the pair, moving a value out of the port and into the
2996
2980
@var {lval }. The expression causes the receiving task to enter the @emph {blocked
2997
2981
reading } state until a task is sending a value to the port, at which point the
2998
2982
runtime pseudo-randomly selects a sending task and copies a value from the
@@ -3002,7 +2986,8 @@ un-blocks the receiving task. @xref{Ref.Run.Comm}.
3002
2986
An example of a @emph {receive }:
3003
2987
@example
3004
2988
port[str] p = @dots {};
3005
- let s: str <- p;
2989
+ let s: str;
2990
+ p |> p;
3006
2991
@end example
3007
2992
3008
2993
@node Ref.Expr.Call
@@ -3410,7 +3395,7 @@ let x: int = 0;
3410
3395
let strs: vec[str];
3411
3396
3412
3397
alt @{
3413
- case (str s <- p ) @{
3398
+ case (str s; p |> s ) @{
3414
3399
vec::append(strs, s);
3415
3400
@}
3416
3401
case (c <| x) @{
0 commit comments