Skip to content

Commit 3a0bddb

Browse files
committed
---
yaml --- r: 147299 b: refs/heads/try2 c: 4a13364 h: refs/heads/master i: 147297: f604df7 147295: 617aff1 v: v3
1 parent 455b0df commit 3a0bddb

File tree

150 files changed

+3561
-4838
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+3561
-4838
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: fb6ec38352b56250045f7450af4eb2af1a019dcd
8+
refs/heads/try2: 4a1336401072bdbac9601c97e278795b1a4b9763
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/configure

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -559,27 +559,6 @@ then
559559
step_msg "on OS X 10.9, forcing use of clang"
560560
CFG_ENABLE_CLANG=1
561561
putvar CFG_ENABLE_CLANG
562-
else
563-
# on OS X, with xcode 5 and newer, certain developers may have
564-
# cc, gcc and g++ point to a mixture of clang and gcc
565-
# if so, this will create very strange build errors
566-
# this last stanza is to detect some such problems and save the future rust
567-
# contributor some time solving that issue.
568-
# this detection could be generalized to other OSes aside from OS X
569-
# but the issue seems most likely to happen on OS X
570-
571-
chk_cc () {
572-
$1 --version 2> /dev/null | grep -q $2
573-
}
574-
# check that gcc, cc and g++ all point to the same compiler.
575-
# note that for xcode 5, g++ points to clang, not clang++
576-
if !((chk_cc gcc clang && chk_cc g++ clang) ||
577-
(chk_cc gcc gcc &&( chk_cc g++ g++ || chk g++ gcc))) then
578-
err "the gcc and g++ in your path point to different compilers.
579-
Check which versions are in your path with cc --version and g++ --version.
580-
To resolve this problem, either fix your PATH or run configure with --enable-clang"
581-
fi
582-
583562
fi
584563
fi
585564

branches/try2/doc/rust.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3329,12 +3329,6 @@ The kinds are:
33293329
This kind includes scalars, owning pointers, owned closures, and
33303330
structural types containing only other owned types.
33313331
All `Send` types are `'static`.
3332-
`Pod`
3333-
: Types of this kind consist of "Plain Old Data"
3334-
which can be copied by simply moving bits.
3335-
All values of this kind can be implicitly copied.
3336-
This kind includes scalars and immutable references,
3337-
as well as structural types containing other `Pod` types.
33383332
`'static`
33393333
: Types of this kind do not contain any borrowed pointers;
33403334
this can be a useful guarantee for code

branches/try2/doc/tutorial-tasks.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,17 @@ receiving messages. Pipes are low-level communication building-blocks and so
121121
come in a variety of forms, each one appropriate for a different use case. In
122122
what follows, we cover the most commonly used varieties.
123123

124-
The simplest way to create a pipe is to use `Chan::new`
124+
The simplest way to create a pipe is to use the `comm::stream`
125125
function to create a `(Port, Chan)` pair. In Rust parlance, a *channel*
126126
is a sending endpoint of a pipe, and a *port* is the receiving
127127
endpoint. Consider the following example of calculating two results
128128
concurrently:
129129

130130
~~~~
131131
# use std::task::spawn;
132+
# use std::comm::{stream, Port, Chan};
132133
133-
let (port, chan): (Port<int>, Chan<int>) = Chan::new();
134+
let (port, chan): (Port<int>, Chan<int>) = stream();
134135
135136
do spawn || {
136137
let result = some_expensive_computation();
@@ -149,7 +150,8 @@ stream for sending and receiving integers (the left-hand side of the `let`,
149150
a tuple into its component parts).
150151

151152
~~~~
152-
let (port, chan): (Port<int>, Chan<int>) = Chan::new();
153+
# use std::comm::{stream, Chan, Port};
154+
let (port, chan): (Port<int>, Chan<int>) = stream();
153155
~~~~
154156

155157
The child task will use the channel to send data to the parent task,
@@ -158,8 +160,9 @@ spawns the child task.
158160

159161
~~~~
160162
# use std::task::spawn;
163+
# use std::comm::stream;
161164
# fn some_expensive_computation() -> int { 42 }
162-
# let (port, chan) = Chan::new();
165+
# let (port, chan) = stream();
163166
do spawn || {
164167
let result = some_expensive_computation();
165168
chan.send(result);
@@ -177,23 +180,25 @@ computation, then waits for the child's result to arrive on the
177180
port:
178181

179182
~~~~
183+
# use std::comm::{stream};
180184
# fn some_other_expensive_computation() {}
181-
# let (port, chan) = Chan::<int>::new();
185+
# let (port, chan) = stream::<int>();
182186
# chan.send(0);
183187
some_other_expensive_computation();
184188
let result = port.recv();
185189
~~~~
186190

187-
The `Port` and `Chan` pair created by `Chan::new` enables efficient
188-
communication between a single sender and a single receiver, but multiple
189-
senders cannot use a single `Chan`, and multiple receivers cannot use a single
190-
`Port`. What if our example needed to compute multiple results across a number
191-
of tasks? The following program is ill-typed:
191+
The `Port` and `Chan` pair created by `stream` enables efficient communication
192+
between a single sender and a single receiver, but multiple senders cannot use
193+
a single `Chan`, and multiple receivers cannot use a single `Port`. What if our
194+
example needed to compute multiple results across a number of tasks? The
195+
following program is ill-typed:
192196

193197
~~~ {.xfail-test}
194198
# use std::task::{spawn};
199+
# use std::comm::{stream, Port, Chan};
195200
# fn some_expensive_computation() -> int { 42 }
196-
let (port, chan) = Chan::new();
201+
let (port, chan) = stream();
197202
198203
do spawn {
199204
chan.send(some_expensive_computation());
@@ -211,8 +216,10 @@ Instead we can use a `SharedChan`, a type that allows a single
211216

212217
~~~
213218
# use std::task::spawn;
219+
# use std::comm::{stream, SharedChan};
214220
215-
let (port, chan) = SharedChan::new();
221+
let (port, chan) = stream();
222+
let chan = SharedChan::new(chan);
216223
217224
for init_val in range(0u, 3) {
218225
// Create a new channel handle to distribute to the child task
@@ -231,22 +238,23 @@ Here we transfer ownership of the channel into a new `SharedChan` value. Like
231238
as an *affine* or *linear* type). Unlike with `Chan`, though, the programmer
232239
may duplicate a `SharedChan`, with the `clone()` method. A cloned
233240
`SharedChan` produces a new handle to the same channel, allowing multiple
234-
tasks to send data to a single port. Between `spawn`, `Chan` and
241+
tasks to send data to a single port. Between `spawn`, `stream` and
235242
`SharedChan`, we have enough tools to implement many useful concurrency
236243
patterns.
237244

238245
Note that the above `SharedChan` example is somewhat contrived since
239-
you could also simply use three `Chan` pairs, but it serves to
246+
you could also simply use three `stream` pairs, but it serves to
240247
illustrate the point. For reference, written with multiple streams, it
241248
might look like the example below.
242249

243250
~~~
244251
# use std::task::spawn;
252+
# use std::comm::stream;
245253
# use std::vec;
246254
247255
// Create a vector of ports, one for each child task
248256
let ports = vec::from_fn(3, |init_val| {
249-
let (port, chan) = Chan::new();
257+
let (port, chan) = stream();
250258
do spawn {
251259
chan.send(some_expensive_computation(init_val));
252260
}
@@ -333,7 +341,7 @@ fn main() {
333341
let numbers_arc = Arc::new(numbers);
334342
335343
for num in range(1u, 10) {
336-
let (port, chan) = Chan::new();
344+
let (port, chan) = stream();
337345
chan.send(numbers_arc.clone());
338346
339347
do spawn {
@@ -362,7 +370,7 @@ and a clone of it is sent to each task
362370
# use std::rand;
363371
# let numbers=vec::from_fn(1000000, |_| rand::random::<f64>());
364372
# let numbers_arc = Arc::new(numbers);
365-
# let (port, chan) = Chan::new();
373+
# let (port, chan) = stream();
366374
chan.send(numbers_arc.clone());
367375
~~~
368376
copying only the wrapper and not its contents.
@@ -374,7 +382,7 @@ Each task recovers the underlying data by
374382
# use std::rand;
375383
# let numbers=vec::from_fn(1000000, |_| rand::random::<f64>());
376384
# let numbers_arc=Arc::new(numbers);
377-
# let (port, chan) = Chan::new();
385+
# let (port, chan) = stream();
378386
# chan.send(numbers_arc.clone());
379387
# let local_arc : Arc<~[f64]> = port.recv();
380388
let task_numbers = local_arc.get();
@@ -491,7 +499,7 @@ Here is the code for the parent task:
491499
# }
492500
# fn main() {
493501
494-
let (from_child, to_child) = DuplexStream::new();
502+
let (from_child, to_child) = DuplexStream();
495503
496504
do spawn {
497505
stringifier(&to_child);

branches/try2/src/etc/licenseck.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
"rt/isaac/rand.h", # public domain
7878
"rt/isaac/standard.h", # public domain
7979
"libstd/rt/mpsc_queue.rs", # BSD
80-
"libstd/rt/spsc_queue.rs", # BSD
8180
"libstd/rt/mpmc_bounded_queue.rs", # BSD
8281
]
8382

branches/try2/src/libextra/arc.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -597,14 +597,15 @@ mod tests {
597597

598598
use arc::*;
599599

600+
use std::comm;
600601
use std::task;
601602

602603
#[test]
603604
fn manually_share_arc() {
604605
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
605606
let arc_v = Arc::new(v);
606607

607-
let (p, c) = Chan::new();
608+
let (p, c) = comm::stream();
608609

609610
do task::spawn {
610611
let arc_v: Arc<~[int]> = p.recv();
@@ -625,7 +626,7 @@ mod tests {
625626
fn test_mutex_arc_condvar() {
626627
let arc = ~MutexArc::new(false);
627628
let arc2 = ~arc.clone();
628-
let (p,c) = Chan::new();
629+
let (p,c) = comm::oneshot();
629630
do task::spawn {
630631
// wait until parent gets in
631632
p.recv();
@@ -635,8 +636,9 @@ mod tests {
635636
})
636637
}
637638

639+
let mut c = Some(c);
638640
arc.access_cond(|state, cond| {
639-
c.send(());
641+
c.take_unwrap().send(());
640642
assert!(!*state);
641643
while !*state {
642644
cond.wait();
@@ -648,7 +650,7 @@ mod tests {
648650
fn test_arc_condvar_poison() {
649651
let arc = ~MutexArc::new(1);
650652
let arc2 = ~arc.clone();
651-
let (p, c) = Chan::new();
653+
let (p, c) = comm::stream();
652654

653655
do spawn {
654656
let _ = p.recv();
@@ -685,7 +687,7 @@ mod tests {
685687
pub fn test_mutex_arc_unwrap_poison() {
686688
let arc = MutexArc::new(1);
687689
let arc2 = ~(&arc).clone();
688-
let (p, c) = Chan::new();
690+
let (p, c) = comm::stream();
689691
do task::spawn {
690692
arc2.access(|one| {
691693
c.send(());
@@ -802,7 +804,7 @@ mod tests {
802804
fn test_rw_arc() {
803805
let arc = RWArc::new(0);
804806
let arc2 = arc.clone();
805-
let (p, c) = Chan::new();
807+
let (p, c) = comm::stream();
806808

807809
do task::spawn {
808810
arc2.write(|num| {
@@ -830,7 +832,7 @@ mod tests {
830832
});
831833

832834
// Wait for children to pass their asserts
833-
for r in children.mut_iter() {
835+
for r in children.iter() {
834836
r.recv();
835837
}
836838

@@ -853,7 +855,7 @@ mod tests {
853855
// Reader tasks
854856
let mut reader_convos = ~[];
855857
10.times(|| {
856-
let ((rp1, rc1), (rp2, rc2)) = (Chan::new(), Chan::new());
858+
let ((rp1, rc1), (rp2, rc2)) = (comm::stream(), comm::stream());
857859
reader_convos.push((rc1, rp2));
858860
let arcn = arc.clone();
859861
do task::spawn {
@@ -867,7 +869,7 @@ mod tests {
867869

868870
// Writer task
869871
let arc2 = arc.clone();
870-
let ((wp1, wc1), (wp2, wc2)) = (Chan::new(), Chan::new());
872+
let ((wp1, wc1), (wp2, wc2)) = (comm::stream(), comm::stream());
871873
do task::spawn || {
872874
wp1.recv();
873875
arc2.write_cond(|state, cond| {
@@ -895,14 +897,14 @@ mod tests {
895897
assert_eq!(*state, 42);
896898
*state = 31337;
897899
// send to other readers
898-
for &(ref mut rc, _) in reader_convos.mut_iter() {
900+
for &(ref rc, _) in reader_convos.iter() {
899901
rc.send(())
900902
}
901903
});
902904
let read_mode = arc.downgrade(write_mode);
903905
read_mode.read(|state| {
904906
// complete handshake with other readers
905-
for &(_, ref mut rp) in reader_convos.mut_iter() {
907+
for &(_, ref rp) in reader_convos.iter() {
906908
rp.recv()
907909
}
908910
wc1.send(()); // tell writer to try again
@@ -924,7 +926,7 @@ mod tests {
924926
// "blk(&Condvar { order: opt_lock, ..*cond })"
925927
// with just "blk(cond)".
926928
let x = RWArc::new(true);
927-
let (wp, wc) = Chan::new();
929+
let (wp, wc) = comm::stream();
928930

929931
// writer task
930932
let xw = x.clone();
@@ -949,7 +951,7 @@ mod tests {
949951
});
950952
// make a reader task to trigger the "reader cloud lock" handoff
951953
let xr = x.clone();
952-
let (rp, rc) = Chan::new();
954+
let (rp, rc) = comm::stream();
953955
do task::spawn {
954956
rc.send(());
955957
xr.read(|_state| { })

0 commit comments

Comments
 (0)