Skip to content

Commit 3582969

Browse files
committed
---
yaml --- r: 148925 b: refs/heads/try2 c: da45340 h: refs/heads/master i: 148923: 4cbb4d5 v: v3
1 parent a367dfb commit 3582969

File tree

117 files changed

+600
-1668
lines changed

Some content is hidden

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

117 files changed

+600
-1668
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: d8c4e78603eb1f658516dde08868abbe6c06bd35
8+
refs/heads/try2: da45340ab84603cf6932b012b977bc2e7b8d6764
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,25 @@
4949
# automatically generated for all stage/host/target combinations.
5050
################################################################################
5151

52-
TARGET_CRATES := std extra green rustuv native flate arena glob term semver uuid serialize sync
52+
TARGET_CRATES := std extra green rustuv native flate arena glob term semver uuid
5353
HOST_CRATES := syntax rustc rustdoc
5454
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5555
TOOLS := compiletest rustdoc rustc
5656

5757
DEPS_std := native:rustrt
58-
DEPS_extra := std serialize sync term
58+
DEPS_extra := std term
5959
DEPS_green := std
6060
DEPS_rustuv := std native:uv native:uv_support
6161
DEPS_native := std
62-
DEPS_syntax := std extra term serialize
63-
DEPS_rustc := syntax native:rustllvm flate arena serialize sync
64-
DEPS_rustdoc := rustc native:sundown serialize sync
62+
DEPS_syntax := std extra term
63+
DEPS_rustc := syntax native:rustllvm flate arena
64+
DEPS_rustdoc := rustc native:sundown
6565
DEPS_flate := std native:miniz
6666
DEPS_arena := std extra
6767
DEPS_glob := std
68-
DEPS_serialize := std
6968
DEPS_term := std
7069
DEPS_semver := std
71-
DEPS_uuid := std serialize
72-
DEPS_sync := std
70+
DEPS_uuid := std extra
7371

7472
TOOL_DEPS_compiletest := extra green rustuv
7573
TOOL_DEPS_rustdoc := rustdoc green rustuv

branches/try2/src/doc/guide-tasks.md

Lines changed: 33 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -39,51 +39,26 @@ data through the global _exchange heap_.
3939

4040
While Rust's type system provides the building blocks needed for safe
4141
and efficient tasks, all of the task functionality itself is implemented
42-
in the standard and sync libraries, which are still under development
42+
in the standard and extra libraries, which are still under development
4343
and do not always present a consistent or complete interface.
4444

4545
For your reference, these are the standard modules involved in Rust
4646
concurrency at this writing:
4747

4848
* [`std::task`] - All code relating to tasks and task scheduling,
4949
* [`std::comm`] - The message passing interface,
50-
* [`sync::DuplexStream`] - An extension of `pipes::stream` that allows both sending and receiving,
51-
* [`sync::SyncChan`] - An extension of `pipes::stream` that provides synchronous message sending,
52-
* [`sync::SyncPort`] - An extension of `pipes::stream` that acknowledges each message received,
53-
* [`sync::rendezvous`] - Creates a stream whose channel, upon sending a message, blocks until the
54-
message is received.
55-
* [`sync::Arc`] - The Arc (atomically reference counted) type, for safely sharing immutable data,
56-
* [`sync::RWArc`] - A dual-mode Arc protected by a reader-writer lock,
57-
* [`sync::MutexArc`] - An Arc with mutable data protected by a blocking mutex,
58-
* [`sync::Semaphore`] - A counting, blocking, bounded-waiting semaphore,
59-
* [`sync::Mutex`] - A blocking, bounded-waiting, mutual exclusion lock with an associated
60-
FIFO condition variable,
61-
* [`sync::RWLock`] - A blocking, no-starvation, reader-writer lock with an associated condvar,
62-
* [`sync::Barrier`] - A barrier enables multiple tasks to synchronize the beginning
63-
of some computation,
64-
* [`sync::TaskPool`] - A task pool abstraction,
65-
* [`sync::Future`] - A type encapsulating the result of a computation which may not be complete,
66-
* [`sync::one`] - A "once initialization" primitive
67-
* [`sync::mutex`] - A proper mutex implementation regardless of the "flavor of task" which is
68-
acquiring the lock.
50+
* [`extra::comm`] - Additional messaging types based on `std::comm`,
51+
* [`extra::sync`] - More exotic synchronization tools, including locks,
52+
* [`extra::arc`] - The Arc (atomically reference counted) type,
53+
for safely sharing immutable data,
54+
* [`extra::future`] - A type representing values that may be computed concurrently and retrieved at a later time.
6955

7056
[`std::task`]: std/task/index.html
7157
[`std::comm`]: std/comm/index.html
72-
[`sync::DuplexStream`]: sync/struct.DuplexStream.html
73-
[`sync::SyncChan`]: sync/struct.SyncChan.html
74-
[`sync::SyncPort`]: sync/struct.SyncPort.html
75-
[`sync::rendezvous`]: sync/fn.rendezvous.html
76-
[`sync::Arc`]: sync/struct.Arc.html
77-
[`sync::RWArc`]: sync/struct.RWArc.html
78-
[`sync::MutexArc`]: sync/struct.MutexArc.html
79-
[`sync::Semaphore`]: sync/struct.Semaphore.html
80-
[`sync::Mutex`]: sync/struct.Mutex.html
81-
[`sync::RWLock`]: sync/struct.RWLock.html
82-
[`sync::Barrier`]: sync/struct.Barrier.html
83-
[`sync::TaskPool`]: sync/struct.TaskPool.html
84-
[`sync::Future`]: sync/struct.Future.html
85-
[`sync::one`]: sync/one/index.html
86-
[`sync::mutex`]: sync/mutex/index.html
58+
[`extra::comm`]: extra/comm/index.html
59+
[`extra::sync`]: extra/sync/index.html
60+
[`extra::arc`]: extra/arc/index.html
61+
[`extra::future`]: extra/future/index.html
8762

8863
# Basics
8964

@@ -279,25 +254,21 @@ let result = ports.iter().fold(0, |accum, port| accum + port.recv() );
279254
~~~
280255

281256
## Backgrounding computations: Futures
282-
With `sync::Future`, rust has a mechanism for requesting a computation and getting the result
257+
With `extra::future`, rust has a mechanism for requesting a computation and getting the result
283258
later.
284259

285260
The basic example below illustrates this.
286261

287262
~~~
288-
# extern mod sync;
289-
290-
# fn main() {
291263
# fn make_a_sandwich() {};
292264
fn fib(n: u64) -> u64 {
293265
// lengthy computation returning an uint
294266
12586269025
295267
}
296268
297-
let mut delayed_fib = sync::Future::spawn(proc() fib(50));
269+
let mut delayed_fib = extra::future::Future::spawn(proc() fib(50));
298270
make_a_sandwich();
299271
println!("fib(50) = {:?}", delayed_fib.get())
300-
# }
301272
~~~
302273

303274
The call to `future::spawn` returns immediately a `future` object regardless of how long it
@@ -310,7 +281,6 @@ Here is another example showing how futures allow you to background computations
310281
be distributed on the available cores.
311282

312283
~~~
313-
# extern mod sync;
314284
# use std::vec;
315285
fn partial_sum(start: uint) -> f64 {
316286
let mut local_sum = 0f64;
@@ -321,7 +291,7 @@ fn partial_sum(start: uint) -> f64 {
321291
}
322292
323293
fn main() {
324-
let mut futures = vec::from_fn(1000, |ind| sync::Future::spawn( proc() { partial_sum(ind) }));
294+
let mut futures = vec::from_fn(1000, |ind| extra::future::Future::spawn( proc() { partial_sum(ind) }));
325295
326296
let mut final_res = 0f64;
327297
for ft in futures.mut_iter() {
@@ -339,17 +309,16 @@ add up to a significant amount of wasted memory and would require copying the sa
339309
necessary.
340310

341311
To tackle this issue, one can use an Atomically Reference Counted wrapper (`Arc`) as implemented in
342-
the `sync` library of Rust. With an Arc, the data will no longer be copied for each task. The Arc
312+
the `extra` library of Rust. With an Arc, the data will no longer be copied for each task. The Arc
343313
acts as a reference to the shared data and only this reference is shared and cloned.
344314

345315
Here is a small example showing how to use Arcs. We wish to run concurrently several computations on
346316
a single large vector of floats. Each task needs the full vector to perform its duty.
347317

348318
~~~
349-
# extern mod sync;
350319
# use std::vec;
351320
# use std::rand;
352-
use sync::Arc;
321+
use extra::arc::Arc;
353322
354323
fn pnorm(nums: &~[f64], p: uint) -> f64 {
355324
nums.iter().fold(0.0, |a,b| a+(*b).powf(&(p as f64)) ).powf(&(1.0 / (p as f64)))
@@ -379,48 +348,39 @@ at the power given as argument and takes the inverse power of this value). The A
379348
created by the line
380349

381350
~~~
382-
# extern mod sync;
383-
# use sync::Arc;
351+
# use extra::arc::Arc;
384352
# use std::vec;
385353
# use std::rand;
386-
# fn main() {
387354
# let numbers = vec::from_fn(1000000, |_| rand::random::<f64>());
388355
let numbers_arc=Arc::new(numbers);
389-
# }
390356
~~~
391357

392358
and a clone of it is sent to each task
393359

394360
~~~
395-
# extern mod sync;
396-
# use sync::Arc;
361+
# use extra::arc::Arc;
397362
# use std::vec;
398363
# use std::rand;
399-
# fn main() {
400364
# let numbers=vec::from_fn(1000000, |_| rand::random::<f64>());
401365
# let numbers_arc = Arc::new(numbers);
402366
# let (port, chan) = Chan::new();
403367
chan.send(numbers_arc.clone());
404-
# }
405368
~~~
406369

407370
copying only the wrapper and not its contents.
408371

409372
Each task recovers the underlying data by
410373

411374
~~~
412-
# extern mod sync;
413-
# use sync::Arc;
375+
# use extra::arc::Arc;
414376
# use std::vec;
415377
# use std::rand;
416-
# fn main() {
417378
# let numbers=vec::from_fn(1000000, |_| rand::random::<f64>());
418379
# let numbers_arc=Arc::new(numbers);
419380
# let (port, chan) = Chan::new();
420381
# chan.send(numbers_arc.clone());
421382
# let local_arc : Arc<~[f64]> = port.recv();
422383
let task_numbers = local_arc.get();
423-
# }
424384
~~~
425385

426386
and can use it as if it were local.
@@ -490,27 +450,25 @@ proceed).
490450

491451
A very common thing to do is to spawn a child task where the parent
492452
and child both need to exchange messages with each other. The
493-
function `sync::comm::DuplexStream()` supports this pattern. We'll
453+
function `extra::comm::DuplexStream()` supports this pattern. We'll
494454
look briefly at how to use it.
495455

496456
To see how `DuplexStream()` works, we will create a child task
497457
that repeatedly receives a `uint` message, converts it to a string, and sends
498458
the string in response. The child terminates when it receives `0`.
499459
Here is the function that implements the child task:
500460

501-
~~~
502-
# extern mod sync;
503-
# fn main() {
504-
# use sync::DuplexStream;
505-
fn stringifier(channel: &DuplexStream<~str, uint>) {
506-
let mut value: uint;
507-
loop {
508-
value = channel.recv();
509-
channel.send(value.to_str());
510-
if value == 0 { break; }
511-
}
461+
~~~{.ignore .linked-failure}
462+
# use extra::comm::DuplexStream;
463+
# use std::uint;
464+
fn stringifier(channel: &DuplexStream<~str, uint>) {
465+
let mut value: uint;
466+
loop {
467+
value = channel.recv();
468+
channel.send(uint::to_str(value));
469+
if value == 0 { break; }
512470
}
513-
# }
471+
}
514472
~~~~
515473
516474
The implementation of `DuplexStream` supports both sending and
@@ -523,15 +481,15 @@ response itself is simply the stringified version of the received value,
523481
524482
Here is the code for the parent task:
525483
526-
~~~
527-
# extern mod sync;
484+
~~~{.ignore .linked-failure}
528485
# use std::task::spawn;
529-
# use sync::DuplexStream;
486+
# use std::uint;
487+
# use extra::comm::DuplexStream;
530488
# fn stringifier(channel: &DuplexStream<~str, uint>) {
531489
# let mut value: uint;
532490
# loop {
533491
# value = channel.recv();
534-
# channel.send(value.to_str());
492+
# channel.send(uint::to_str(value));
535493
# if value == 0u { break; }
536494
# }
537495
# }

branches/try2/src/doc/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ li {list-style-type: none; }
4141
* [The `flate` compression library](flate/index.html)
4242
* [The `glob` file path matching library](glob/index.html)
4343
* [The `semver` version collation library](semver/index.html)
44-
* [The `serialize` value encoding/decoding library](serialize/index.html)
45-
* [The `sync` library for concurrency-enabled mechanisms and primitives](sync/index.html)
4644
* [The `term` terminal-handling library](term/index.html)
47-
* [The `uuid` 128-bit universally unique identifier library](uuid/index.html)
45+
* [The UUID library](uuid/index.html)
4846

4947
# Tooling
5048

branches/try2/src/doc/tutorial.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ fn angle(vector: (f64, f64)) -> f64 {
509509
let pi = f64::consts::PI;
510510
match vector {
511511
(0.0, y) if y < 0.0 => 1.5 * pi,
512-
(0.0, _) => 0.5 * pi,
512+
(0.0, y) => 0.5 * pi,
513513
(x, y) => atan(y / x)
514514
}
515515
}
@@ -519,9 +519,7 @@ A variable name in a pattern matches any value, *and* binds that name
519519
to the value of the matched value inside of the arm's action. Thus, `(0.0,
520520
y)` matches any tuple whose first element is zero, and binds `y` to
521521
the second element. `(x, y)` matches any two-element tuple, and binds both
522-
elements to variables. `(0.0,_)` matches any tuple whose first element is zero
523-
and does not bind anything to the second element.
524-
522+
elements to variables.
525523
A subpattern can also be bound to a variable, using `variable @ pattern`. For
526524
example:
527525

branches/try2/src/etc/check-summary.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2-
# file at the top-level directory of this distribution and at
3-
# http://rust-lang.org/COPYRIGHT.
4-
#
5-
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
# option. This file may not be copied, modified, or distributed
9-
# except according to those terms.
1+
#!/usr/bin/env python
2+
# xfail-license
103

114
import glob
125
import sys

branches/try2/src/etc/combine-tests.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
# Copyright 2011-2013 The Rust Project Developers. See the COPYRIGHT
2-
# file at the top-level directory of this distribution and at
3-
# http://rust-lang.org/COPYRIGHT.
4-
#
5-
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
# option. This file may not be copied, modified, or distributed
9-
# except according to those terms.
1+
#!/usr/bin/env python
2+
# xfail-license
103

11-
# This combines all the working run-pass tests into a single large crate so we
4+
# this combines all the working run-pass tests into a single large crate so we
125
# can run it "fast": spawning zillions of windows processes is our major build
136
# bottleneck (and it doesn't hurt to run faster on other platforms as well).
147

branches/try2/src/etc/copy-runtime-deps.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2-
# file at the top-level directory of this distribution and at
3-
# http://rust-lang.org/COPYRIGHT.
4-
#
5-
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
# option. This file may not be copied, modified, or distributed
9-
# except according to those terms.
1+
#!/usr/bin/env python
2+
# xfail-license
103

11-
# Copies Rust runtime dependencies to the specified directory.
4+
# Copies Rust runtime dependencies to the specified directory
125

136
import snapshot, sys, os, shutil
147

branches/try2/src/etc/extract-tests.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2-
# file at the top-level directory of this distribution and at
3-
# http://rust-lang.org/COPYRIGHT.
4-
#
5-
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
# option. This file may not be copied, modified, or distributed
9-
# except according to those terms.
10-
1+
# xfail-license
2+
# -*- coding: utf-8 -*-
113
"""
124
Script for extracting compilable fragments from markdown documentation. See
135
prep.js for a description of the format recognized by this tool. Expects

branches/try2/src/etc/extract_grammar.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2-
# file at the top-level directory of this distribution and at
3-
# http://rust-lang.org/COPYRIGHT.
4-
#
5-
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
# option. This file may not be copied, modified, or distributed
9-
# except according to those terms.
1+
#!/usr/bin/env python
2+
# xfail-license
103

114
# This script is for extracting the grammar from the rust docs.
125

0 commit comments

Comments
 (0)