diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-06-07 11:13:26 -0700 | 
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-11 10:00:43 -0700 | 
| commit | b1c9ce9c6f0eb7d4a7df1aad6b6799f4b548181c (patch) | |
| tree | 219196013c141f0f2110ac1df21db05433a71e4b /src/libsync/lib.rs | |
| parent | c690191a84728c289a4b3dc17b07934a66311d9d (diff) | |
| download | rust-b1c9ce9c6f0eb7d4a7df1aad6b6799f4b548181c.tar.gz rust-b1c9ce9c6f0eb7d4a7df1aad6b6799f4b548181c.zip  | |
sync: Move underneath libstd
This commit is the final step in the libstd facade, #13851. The purpose of this commit is to move libsync underneath the standard library, behind the facade. This will allow core primitives like channels, queues, and atomics to all live in the same location. There were a few notable changes and a few breaking changes as part of this movement: * The `Vec` and `String` types are reexported at the top level of libcollections * The `unreachable!()` macro was copied to libcore * The `std::rt::thread` module was moved to librustrt, but it is still reexported at the same location. * The `std::comm` module was moved to libsync * The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`. It is now a private module with types/functions being reexported under `sync::comm`. This is a breaking change for any existing users of duplex streams. * All concurrent queues/deques were moved directly under libsync. They are also all marked with #![experimental] for now if they are public. * The `task_pool` and `future` modules no longer live in libsync, but rather live under `std::sync`. They will forever live at this location, but they may move to libsync if the `std::task` module moves as well. [breaking-change]
Diffstat (limited to 'src/libsync/lib.rs')
| -rw-r--r-- | src/libsync/lib.rs | 64 | 
1 files changed, 46 insertions, 18 deletions
diff --git a/src/libsync/lib.rs b/src/libsync/lib.rs index 44d17e6fb95..9f010928256 100644 --- a/src/libsync/lib.rs +++ b/src/libsync/lib.rs @@ -8,9 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -/*! - * Concurrency-enabled mechanisms and primitives. - */ +//! Core concurrency-enabled mechanisms and primitives. +//! +//! This crate contains the implementations of Rust's core synchronization +//! primitives. This includes channels, mutexes, condition variables, etc. +//! +//! The interface of this crate is experimental, and it is not recommended to +//! use this crate specifically. Instead, its functionality is reexported +//! through `std::sync`. #![crate_id = "sync#0.11.0-pre"] #![crate_type = "rlib"] @@ -20,22 +25,24 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(phase)] +#![feature(phase, globs, macro_rules)] #![deny(deprecated_owned_vector)] - #![deny(missing_doc)] +#![no_std] -#[cfg(test, stage0)] -#[phase(syntax, link)] extern crate log; - -#[cfg(test, not(stage0))] -#[phase(plugin, link)] extern crate log; - +#[cfg(stage0)] +#[phase(syntax, link)] extern crate core; +#[cfg(not(stage0))] +#[phase(plugin, link)] extern crate core; extern crate alloc; +extern crate collections; +extern crate rustrt; + +#[cfg(test)] extern crate test; +#[cfg(test)] extern crate native; +#[cfg(test, stage0)] #[phase(syntax, link)] extern crate std; +#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate std; -pub use comm::{DuplexStream, duplex}; -pub use task_pool::TaskPool; -pub use future::Future; pub use alloc::arc::{Arc, Weak}; pub use lock::{Mutex, MutexGuard, Condvar, Barrier, RWLock, RWLockReadGuard, RWLockWriteGuard}; @@ -43,12 +50,33 @@ pub use lock::{Mutex, MutexGuard, Condvar, Barrier, // The mutex/rwlock in this module are not meant for reexport pub use raw::{Semaphore, SemaphoreGuard}; -mod comm; -mod future; -mod lock; +// Core building blocks for all primitives in this crate + +pub mod atomics; + +// Concurrent data structures + mod mpsc_intrusive; -mod task_pool; +pub mod spsc_queue; +pub mod mpsc_queue; +pub mod mpmc_bounded_queue; +pub mod deque; + +// Low-level concurrency primitives pub mod raw; pub mod mutex; pub mod one; + +// Message-passing based communication + +pub mod comm; + +// Higher level primitives based on those above + +mod lock; + +#[cfg(not(test))] +mod std { + pub use core::{fmt, option, cmp, clone}; +}  | 
