core: Format comm docs correctly
This commit is contained in:
parent
ef941998be
commit
04351a84ca
1 changed files with 20 additions and 16 deletions
|
@ -1,21 +1,25 @@
|
||||||
#[doc(
|
#[doc(
|
||||||
brief = "Communication between tasks",
|
brief = "Communication between tasks",
|
||||||
desc = "Communication between tasks is facilitated by ports (in the \
|
desc = "
|
||||||
receiving task), and channels (in the sending task). Any \
|
|
||||||
number of channels may feed into a single port. \
|
Communication between tasks is facilitated by ports (in the receiving
|
||||||
Ports and channels may only transmit values of unique \
|
task), and channels (in the sending task). Any number of channels may
|
||||||
types; that is, values that are statically guaranteed to \
|
feed into a single port. Ports and channels may only transmit values
|
||||||
be accessed by a single 'owner' at a time. Unique types \
|
of unique types; that is, values that are statically guaranteed to be
|
||||||
include scalars, vectors, strings, and records, tags, \
|
accessed by a single 'owner' at a time. Unique types include scalars,
|
||||||
tuples and unique boxes (~T) thereof. Most notably, \
|
vectors, strings, and records, tags, tuples and unique boxes (`~T`)
|
||||||
shared boxes (@T) may not be transmitted across channels. \
|
thereof. Most notably, shared boxes (`@T`) may not be transmitted
|
||||||
Example: \
|
across channels.
|
||||||
let p = comm::port(); \
|
|
||||||
task::spawn(comm::chan(p), fn (c: chan<str>) { \
|
Example:
|
||||||
comm::send(c, \"Hello, World\"); \
|
|
||||||
}); \
|
let p = comm::port();
|
||||||
io::println(comm::recv(p));"
|
task::spawn(comm::chan(p), fn (c: chan<str>) {
|
||||||
)];
|
comm::send(c, \"Hello, World\");
|
||||||
|
});
|
||||||
|
io::println(comm::recv(p));
|
||||||
|
|
||||||
|
")];
|
||||||
|
|
||||||
import sys;
|
import sys;
|
||||||
import task;
|
import task;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue