2013-12-12 19:27:37 -06:00
|
|
|
// Copyright 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.
|
|
|
|
|
|
|
|
//! Useful synchronization primitives
|
|
|
|
//!
|
2014-08-07 14:14:16 -05:00
|
|
|
//! This module contains useful safe and unsafe synchronization primitives.
|
2013-12-12 19:27:37 -06:00
|
|
|
//! Most of the primitives in this module do not provide any sort of locking
|
|
|
|
//! and/or blocking at all, but rather provide the necessary tools to build
|
|
|
|
//! other types of concurrent primitives.
|
|
|
|
|
2014-06-30 19:22:40 -05:00
|
|
|
#![experimental]
|
|
|
|
|
2014-11-23 14:52:37 -06:00
|
|
|
pub use self::one::{Once, ONCE_INIT};
|
|
|
|
|
|
|
|
pub use alloc::arc::{Arc, Weak};
|
|
|
|
pub use self::lock::{Mutex, MutexGuard, Condvar, Barrier,
|
|
|
|
RWLock, RWLockReadGuard, RWLockWriteGuard};
|
2014-08-04 17:42:36 -05:00
|
|
|
|
2014-11-23 14:52:37 -06:00
|
|
|
// The mutex/rwlock in this module are not meant for reexport
|
|
|
|
pub use self::raw::{Semaphore, SemaphoreGuard};
|
2014-06-07 13:13:26 -05:00
|
|
|
|
|
|
|
pub use self::future::Future;
|
|
|
|
pub use self::task_pool::TaskPool;
|
|
|
|
|
2014-11-23 14:52:37 -06:00
|
|
|
// Core building blocks for all primitives in this crate
|
|
|
|
|
|
|
|
#[stable]
|
|
|
|
pub mod atomic;
|
|
|
|
|
|
|
|
// Concurrent data structures
|
|
|
|
|
|
|
|
pub mod spsc_queue;
|
|
|
|
pub mod mpsc_queue;
|
|
|
|
pub mod mpmc_bounded_queue;
|
|
|
|
pub mod deque;
|
|
|
|
|
|
|
|
// Low-level concurrency primitives
|
|
|
|
|
|
|
|
mod raw;
|
|
|
|
mod mutex;
|
|
|
|
mod one;
|
|
|
|
|
|
|
|
// Higher level primitives based on those above
|
|
|
|
|
|
|
|
mod lock;
|
|
|
|
|
|
|
|
// Task management
|
|
|
|
|
2014-06-07 13:13:26 -05:00
|
|
|
mod future;
|
|
|
|
mod task_pool;
|