core: New closure syntax for comm.rs/task.rs docs
This commit is contained in:
@@ -16,9 +16,9 @@
|
|||||||
* let po = comm::port();
|
* let po = comm::port();
|
||||||
* let ch = comm::chan(po);
|
* let ch = comm::chan(po);
|
||||||
*
|
*
|
||||||
* task::spawn {||
|
* do task::spawn {
|
||||||
* comm::send(ch, "Hello, World");
|
* comm::send(ch, "Hello, World");
|
||||||
* });
|
* }
|
||||||
*
|
*
|
||||||
* io::println(comm::recv(p));
|
* io::println(comm::recv(p));
|
||||||
* ~~~
|
* ~~~
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* # Example
|
* # Example
|
||||||
*
|
*
|
||||||
* ~~~
|
* ~~~
|
||||||
* spawn {||
|
* do spawn {
|
||||||
* log(error, "Hello, World!");
|
* log(error, "Hello, World!");
|
||||||
* }
|
* }
|
||||||
* ~~~
|
* ~~~
|
||||||
@@ -434,7 +434,7 @@ fn spawn_listener<A:send>(+f: fn~(comm::port<A>)) -> comm::chan<A> {
|
|||||||
*
|
*
|
||||||
* let po = comm::port();
|
* let po = comm::port();
|
||||||
* let ch = comm::chan(po);
|
* let ch = comm::chan(po);
|
||||||
* let ch = spawn_listener {|po|
|
* let ch = do spawn_listener |po| {
|
||||||
* // Now the child has a port called 'po' to read from and
|
* // Now the child has a port called 'po' to read from and
|
||||||
* // an environment-captured channel called 'ch'.
|
* // an environment-captured channel called 'ch'.
|
||||||
* };
|
* };
|
||||||
@@ -529,7 +529,7 @@ fn get_task() -> task {
|
|||||||
* # Example
|
* # Example
|
||||||
*
|
*
|
||||||
* ~~~
|
* ~~~
|
||||||
* task::unkillable {||
|
* do task::unkillable {
|
||||||
* // detach / yield / destroy must all be called together
|
* // detach / yield / destroy must all be called together
|
||||||
* rustrt::rust_port_detach(po);
|
* rustrt::rust_port_detach(po);
|
||||||
* // This must not result in the current task being killed
|
* // This must not result in the current task being killed
|
||||||
|
|||||||
Reference in New Issue
Block a user