Skip to content

Move concurrent stuff from lib extra on a separate package #11910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ src/.DS_Store
/doc/rustdoc
/doc/rustuv
/doc/rustpkg
/doc/concurrency
/nd/
/llvm/
version.md
Expand Down
1 change: 1 addition & 0 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ li {list-style-type: none; }
* [The `arena` allocation library](arena/index.html)
* [The `flate` compression library](flate/index.html)
* [The `glob` file path matching library](glob/index.html)
* [The `concurrency` mechanisms and primitives library](concurrency/index.html)

# Tooling

Expand Down
5 changes: 3 additions & 2 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
# automatically generated for all stage/host/target combinations.
################################################################################

TARGET_CRATES := std extra green rustuv native flate arena glob
TARGET_CRATES := std extra green rustuv native flate arena glob concurrency
HOST_CRATES := syntax rustc rustdoc rustpkg
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustpkg rustdoc rustc

DEPS_std := native:rustrt
DEPS_extra := std
DEPS_extra := std concurrency
DEPS_green := std
DEPS_rustuv := std native:uv native:uv_support
DEPS_native := std
Expand All @@ -66,6 +66,7 @@ DEPS_rustpkg := rustc
DEPS_flate := std native:miniz
DEPS_arena := std extra
DEPS_glob := std
DEPS_concurrency := std

TOOL_DEPS_compiletest := extra green rustuv
TOOL_DEPS_rustpkg := rustpkg green rustuv
Expand Down
14 changes: 7 additions & 7 deletions src/libextra/arc.rs → src/libconcurrency/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
* With simple pipes, without Arc, a copy would have to be made for each task.
*
* ```rust
* use extra::arc::Arc;
* extern mod concurrency;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These extern mod statements should be auto-injected by rustdoc, so you can probably remove them.

*
* use concurrency::arc::Arc;
* use std::{rand, vec};
*
* let numbers = vec::from_fn(100, |i| (i as f32) * rand::random());
Expand All @@ -38,9 +40,6 @@
* ```
*/

#[allow(missing_doc)];


use sync;
use sync::{Mutex, RWLock};

Expand Down Expand Up @@ -419,7 +418,9 @@ impl<T:Freeze + Send> RWArc<T> {
* # Example
*
* ```rust
* use extra::arc::RWArc;
* extern mod concurrency;
*
* use concurrency::arc::RWArc;
*
* let arc = RWArc::new(1);
* arc.write_downgrade(|mut write_token| {
Expand Down Expand Up @@ -556,8 +557,7 @@ impl<'a, T:Freeze + Send> RWReadMode<'a, T> {
#[cfg(test)]
mod tests {

use arc::*;

use super::{Arc, RWArc, MutexArc};
use std::task;

#[test]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/libextra/future.rs → src/libconcurrency/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* # Example
*
* ```rust
* use extra::future::Future;
* use concurrency::future::Future;
* # fn fib(n: uint) -> uint {42};
* # fn make_a_sandwich() {};
* let mut delayed_fib = Future::spawn(proc() { fib(5000) });
Expand Down
27 changes: 27 additions & 0 deletions src/libconcurrency/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

/*!
* Concurrency-enabled mechanisms and primitives.
*/

#[allow(missing_doc)];
#[feature(globs)];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to remove this feature? If it's super painful, then we can leave it, but in general it'd be nice if the smaller crates didn't have lots of extra features.


#[crate_id = "concurrency#0.10-pre"];
#[crate_type = "rlib"];
#[crate_type = "lib"];
#[license = "MIT/ASL2"];

pub mod arc;
pub mod sync;
pub mod comm;
pub mod task_pool;
pub mod future;
File renamed without changes.
File renamed without changes.
10 changes: 2 additions & 8 deletions src/libextra/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,12 @@ Rust extras are part of the standard Rust distribution.
#[deny(non_camel_case_types)];
#[deny(missing_doc)];

extern mod concurrency;

// Utility modules

pub mod c_vec;

// Concurrency

pub mod sync;
pub mod arc;
pub mod comm;
pub mod future;
pub mod task_pool;

// Collections

pub mod container;
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/workcache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use json;
use json::ToJson;
use serialize::{Encoder, Encodable, Decoder, Decodable};
use arc::{Arc,RWArc};
use concurrency::arc::{Arc,RWArc};
use treemap::TreeMap;
use std::str;
use std::io;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use std::io::{fs, File, BufferedWriter};
use std::str;
use std::vec;

use extra::arc::Arc;
use concurrency::arc::Arc;
use extra::json::ToJson;
use syntax::ast;
use syntax::attr;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
extern mod syntax;
extern mod rustc;
extern mod extra;
extern mod concurrency;

use std::local_data;
use std::io;
Expand Down
2 changes: 1 addition & 1 deletion src/librustpkg/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub use path_util::default_workspace;
pub use source_control::{safe_git_clone, git_clone_url};

use std::run;
use extra::arc::{Arc,RWArc};
use concurrency::arc::{Arc,RWArc};
use extra::workcache;
use extra::workcache::{Database, FreshnessMap};
use extra::treemap::TreeMap;
Expand Down
1 change: 1 addition & 0 deletions src/librustpkg/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
extern mod extra;
extern mod rustc;
extern mod syntax;
extern mod concurrency;

use std::{os, run, str, task};
use std::io::process;
Expand Down
4 changes: 2 additions & 2 deletions src/librustpkg/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use std::{os, run, str, task};
use std::io;
use std::io::fs;
use std::io::File;
use extra::arc::Arc;
use extra::arc::RWArc;
use concurrency::arc::Arc;
use concurrency::arc::RWArc;
use extra::tempfile::TempDir;
use extra::workcache;
use extra::workcache::Database;
Expand Down
9 changes: 5 additions & 4 deletions src/test/bench/msgsend-ring-mutex-arcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
// This test creates a bunch of tasks that simultaneously send to each
// other in a ring. The messages should all be basically
// independent.
// This is like msgsend-ring-pipes but adapted to use Arcs.
// This is like msgsend-ring-pipes but adapted to use concurrency::arcs.

// This also serves as a pipes test, because Arcs are implemented with pipes.
// This also serves as a pipes test, because concurrency::arcs are implemented with pipes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments should probably stay the same.


extern mod extra;
extern mod concurrency;

use extra::arc;
use extra::future::Future;
use concurrency::arc;
use concurrency::future::Future;
use extra::time;
use std::os;
use std::uint;
Expand Down
9 changes: 5 additions & 4 deletions src/test/bench/msgsend-ring-rw-arcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
// This test creates a bunch of tasks that simultaneously send to each
// other in a ring. The messages should all be basically
// independent.
// This is like msgsend-ring-pipes but adapted to use Arcs.
// This is like msgsend-ring-pipes but adapted to use concurrency::arcs.

// This also serves as a pipes test, because Arcs are implemented with pipes.
// This also serves as a pipes test, because concurrency::arcs are implemented with pipes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, these comments should probably stay the same.


extern mod extra;
extern mod concurrency;

use extra::arc;
use extra::future::Future;
use concurrency::arc;
use concurrency::future::Future;
use extra::time;
use std::os;
use std::uint;
Expand Down
3 changes: 2 additions & 1 deletion src/test/bench/shootout-binarytrees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

extern mod extra;
extern mod arena;
extern mod concurrency;

use std::iter::range_step;
use extra::future::Future;
use concurrency::future::Future;
use arena::TypedArena;

enum Tree<'a> {
Expand Down
6 changes: 3 additions & 3 deletions src/test/bench/shootout-spectralnorm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

// xfail-test arcs no longer unwrap

extern mod extra;
extern mod concurrency;

use std::from_str::FromStr;
use std::iter::count;
use std::num::min;
use std::os;
use std::vec::from_elem;
use extra::arc::Arc;
use extra::arc::RWArc;
use concurrency::arc::Arc;
use concurrency::arc::RWArc;

fn A(i: uint, j: uint) -> f64 {
((i + j) * (i + j + 1) / 2 + i + 1) as f64
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/arc-cant-nest-rw-arc-3177.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern mod extra;
use extra::arc::RWArc;
extern mod concurrency;
use concurrency::arc::RWArc;

fn main() {
let arc1 = RWArc::new(true);
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/arc-rw-cond-shouldnt-escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// except according to those terms.

// error-pattern: lifetime of return value does not outlive the function call
extern mod extra;
use extra::arc;
extern mod concurrency;
use concurrency::arc;
fn main() {
let x = ~arc::RWArc::new(1);
let mut y = None;
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern mod extra;
use extra::arc;
extern mod concurrency;
use concurrency::arc;
fn main() {
let x = ~arc::RWArc::new(1);
let mut y = None;
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/arc-rw-state-shouldnt-escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern mod extra;
use extra::arc;
extern mod concurrency;
use concurrency::arc;
fn main() {
let x = ~arc::RWArc::new(1);
let mut y = None; //~ ERROR lifetime of variable does not enclose its declaration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// except according to those terms.

// error-pattern: lifetime of variable does not enclose its declaration
extern mod extra;
use extra::arc;
extern mod concurrency;
use concurrency::arc;
fn main() {
let x = ~arc::RWArc::new(1);
let mut y = None;
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// except according to those terms.

// error-pattern: lifetime of variable does not enclose its declaration
extern mod extra;
use extra::arc;
extern mod concurrency;
use concurrency::arc;
fn main() {
let x = ~arc::RWArc::new(1);
let mut y = None;
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/functional-struct-update-noncopyable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// issue 7327

// xfail-fast #7103
extern mod extra;
use extra::arc::Arc;
extern mod concurrency;
use concurrency::arc::Arc;

struct A { y: Arc<int>, x: Arc<int> }

Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/future_not_copyable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern mod extra;
extern mod concurrency;

use extra::future::Future;
use concurrency::future::Future;

fn main() {
let f = Future::from_value(());
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/mutex-arc-nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern mod extra;
extern mod concurrency;

use std::task;
use extra::arc::{MutexArc};
use concurrency::arc::{MutexArc};

fn test_mutex_arc_nested() {
let arc = ~MutexArc::new(1);
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/no-capture-arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

// error-pattern: use of moved value

extern mod extra;
use extra::arc;
extern mod concurrency;
use concurrency::arc;

use std::task;

Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/no-reuse-move-arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern mod extra;
use extra::arc;
extern mod concurrency;
use concurrency::arc;

use std::task;

Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/once-cant-call-twice-on-heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// This program would segfault if it were legal.

#[feature(once_fns)];
extern mod extra;
use extra::arc;
extern mod concurrency;
use concurrency::arc;

fn foo(blk: proc()) {
blk();
Expand Down
Loading