Skip to content

Commit 00745da

Browse files
committed
---
yaml --- r: 4566 b: refs/heads/master c: c96f62a h: refs/heads/master v: v3
1 parent 327774e commit 00745da

File tree

2 files changed

+20
-35
lines changed

2 files changed

+20
-35
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 5079f5138649cb8bf52bbde6e2623fdb7d5c45f3
2+
refs/heads/master: c96f62a29d6a2e61c886e7c8509aeb9a44f53164

trunk/doc/rust.texi

+19-34
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,9 @@ The special symbols are:
915915
@tab @code{)}
916916
@item @code{=}
917917
@tab @code{<-}
918+
@tab @code{<->}
918919
@tab @code{<|}
919-
@tab @code{<+}
920+
@tab @code{|>}
920921
@tab @code{->}
921922
@item @code{+}
922923
@tab @code{++}
@@ -1464,21 +1465,20 @@ Each port and channel can carry only one type of message. The message type is
14641465
encoded as a parameter of the channel or port type. The message type of a
14651466
channel is equal to the message type of the port it is bound to.
14661467

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.
14711472

14721473
Queued messages in channels are charged to the domain of the @emph{sending}
14731474
task. If too many messages are queued for transmission from a single sending
14741475
task, without being received by a receiving task, the sending task may exceed
14751476
its memory budget, which causes a run-time signal. To help control this
14761477
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.
14781479

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}.
14821482

14831483
@node Ref.Task.Life
14841484
@subsection Ref.Task.Life
@@ -2344,7 +2344,7 @@ An example of a @code{port} type:
23442344
type port[vec[str]] svp;
23452345
let p: svp = get_port();
23462346
let v: vec[str];
2347-
v <- p;
2347+
p |> v;
23482348
@end example
23492349

23502350
@node Ref.Type.Chan
@@ -2948,7 +2948,7 @@ let out: port[u8];
29482948
let p: task = spawn helper(chan(out));
29492949
let p2: task = spawn "my_helper" helper(chan(out));
29502950
// let task run, do other things.
2951-
let result <- out;
2951+
let out |> result;
29522952
29532953
@end example
29542954

@@ -2958,27 +2958,11 @@ let result <- out;
29582958
@cindex Send expression
29592959
@cindex Communication
29602960

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.
29652964

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:
29822966
@example
29832967
chan[str] c = @dots{};
29842968
c <| "hello, world";
@@ -2992,7 +2976,7 @@ c <| "hello, world";
29922976

29932977
The @dfn{receive expression} takes an @var{lval} to receive into and an
29942978
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
29962980
@var{lval}. The expression causes the receiving task to enter the @emph{blocked
29972981
reading} state until a task is sending a value to the port, at which point the
29982982
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}.
30022986
An example of a @emph{receive}:
30032987
@example
30042988
port[str] p = @dots{};
3005-
let s: str <- p;
2989+
let s: str;
2990+
p |> p;
30062991
@end example
30072992

30082993
@node Ref.Expr.Call
@@ -3410,7 +3395,7 @@ let x: int = 0;
34103395
let strs: vec[str];
34113396
34123397
alt @{
3413-
case (str s <- p) @{
3398+
case (str s; p |> s) @{
34143399
vec::append(strs, s);
34153400
@}
34163401
case (c <| x) @{

0 commit comments

Comments
 (0)