@@ -858,13 +858,14 @@ If a sequence of such redirections form a cycle or cannot be unambiguously resol
858
858
859
859
An example of re-exporting:
860
860
~~~~
861
+ # fn main() { }
861
862
mod quux {
862
- mod foo {
863
+ pub mod foo {
863
864
pub fn bar() { }
864
865
pub fn baz() { }
865
866
}
866
867
867
- pub use foo::*;
868
+ pub use quux:: foo::*;
868
869
}
869
870
~~~~
870
871
@@ -3036,67 +3037,6 @@ An executing task can yield control at any time, by making a library call to
3036
3037
non-executing state (blocked, dead) similarly deschedules the task.
3037
3038
3038
3039
3039
- ### Spawning tasks
3040
-
3041
- A call to ` core::task::spawn ` , passing a 0-argument function as its single
3042
- argument, causes the runtime to construct a new task executing the passed
3043
- function. The passed function is referred to as the _ entry function_ for
3044
- the spawned task, and any captured environment it carries is moved from the
3045
- spawning task to the spawned task before the spawned task begins execution.
3046
-
3047
- The result of a ` spawn ` call is a ` core::task::Task ` value.
3048
-
3049
- An example of a ` spawn ` call:
3050
-
3051
- ~~~~
3052
- let po = comm::Port();
3053
- let ch = comm::Chan(&po);
3054
-
3055
- do task::spawn {
3056
- // let task run, do other things
3057
- ...
3058
- comm::send(ch, true);
3059
- };
3060
-
3061
- let result = comm::recv(po);
3062
- ~~~~
3063
-
3064
-
3065
- ### Sending values into channels
3066
-
3067
- Sending a value into a channel is done by a library call to ` core::comm::send ` ,
3068
- which takes a channel and a value to send, and moves the value into the
3069
- channel's outgoing buffer.
3070
-
3071
- An example of a send:
3072
-
3073
- ~~~~
3074
- let po = comm::Port();
3075
- let ch = comm::Chan(&po);
3076
- comm::send(ch, ~"hello, world");
3077
- ~~~~
3078
-
3079
-
3080
- ### Receiving values from ports
3081
-
3082
- Receiving a value is done by a call to the ` recv ` method on a value of type
3083
- ` core::comm::Port ` . This call causes the receiving task to enter the * blocked
3084
- reading* state until a value arrives in the port's receive queue, at which
3085
- time the port deques a value to return, and un-blocks the receiving task.
3086
-
3087
- An example of a * receive* :
3088
-
3089
- ~~~~~~~~
3090
- # let po = comm::Port();
3091
- # let ch = comm::Chan(&po);
3092
- # comm::send(ch, ~"");
3093
- let s = comm::recv(po);
3094
- ~~~~~~~~
3095
-
3096
- > ** Note:** this communication system will be replaced by a higher-performance system called "pipes",
3097
- > in future versions of Rust.
3098
-
3099
-
3100
3040
# Runtime services, linkage and debugging
3101
3041
3102
3042
0 commit comments