diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 3a9fd36a05e..9d15deab660 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -11,14 +11,9 @@ use private::{SharedMutableState, shared_mutable_state, use sync::{Mutex, mutex_with_condvars, RWlock, rwlock_with_condvars}; -export ARC, clone, get; -export Condvar; -export MutexARC, mutex_arc_with_condvars, unwrap_mutex_arc; -export RWARC, rw_arc_with_condvars, RWWriteMode, RWReadMode; -export unwrap_rw_arc; /// As sync::condvar, a mechanism for unlock-and-descheduling and signalling. -struct Condvar { is_mutex: bool, failed: &mut bool, cond: &sync::Condvar } +pub struct Condvar { is_mutex: bool, failed: &mut bool, cond: &sync::Condvar } impl &Condvar { /// Atomically exit the associated ARC and block until a signal is sent. @@ -71,7 +66,7 @@ impl &Condvar { struct ARC { x: SharedMutableState } /// Create an atomically reference counted wrapper. -fn ARC(+data: T) -> ARC { +pub fn ARC(+data: T) -> ARC { ARC { x: unsafe { shared_mutable_state(move data) } } } @@ -79,7 +74,7 @@ fn ARC(+data: T) -> ARC { * Access the underlying data in an atomically reference counted * wrapper. */ -fn get(rc: &a/ARC) -> &a/T { +pub fn get(rc: &a/ARC) -> &a/T { unsafe { get_shared_immutable_state(&rc.x) } } @@ -90,7 +85,7 @@ fn get(rc: &a/ARC) -> &a/T { * object. However, one of the `arc` objects can be sent to another task, * allowing them to share the underlying data. */ -fn clone(rc: &ARC) -> ARC { +pub fn clone(rc: &ARC) -> ARC { ARC { x: unsafe { clone_shared_mutable_state(&rc.x) } } } @@ -118,14 +113,14 @@ struct MutexARCInner { lock: Mutex, failed: bool, data: T } struct MutexARC { x: SharedMutableState> } /// Create a mutex-protected ARC with the supplied data. -fn MutexARC(+user_data: T) -> MutexARC { +pub fn MutexARC(+user_data: T) -> MutexARC { mutex_arc_with_condvars(move user_data, 1) } /** * Create a mutex-protected ARC with the supplied data and a specified number * of condvars (as sync::mutex_with_condvars). */ -fn mutex_arc_with_condvars(+user_data: T, +pub fn mutex_arc_with_condvars(+user_data: T, num_condvars: uint) -> MutexARC { let data = MutexARCInner { lock: mutex_with_condvars(num_condvars), @@ -196,7 +191,7 @@ impl &MutexARC { * Will additionally fail if another task has failed while accessing the arc. */ // FIXME(#2585) make this a by-move method on the arc -fn unwrap_mutex_arc(+arc: MutexARC) -> T { +pub fn unwrap_mutex_arc(+arc: MutexARC) -> T { let MutexARC { x: x } <- arc; let inner = unsafe { unwrap_shared_mutable_state(move x) }; let MutexARCInner { failed: failed, data: data, _ } <- inner; @@ -252,14 +247,14 @@ struct RWARC { } /// Create a reader/writer ARC with the supplied data. -fn RWARC(+user_data: T) -> RWARC { +pub fn RWARC(+user_data: T) -> RWARC { rw_arc_with_condvars(move user_data, 1) } /** * Create a reader/writer ARC with the supplied data and a specified number * of condvars (as sync::rwlock_with_condvars). */ -fn rw_arc_with_condvars(+user_data: T, +pub fn rw_arc_with_condvars(+user_data: T, num_condvars: uint) -> RWARC { let data = RWARCInner { lock: rwlock_with_condvars(num_condvars), @@ -374,7 +369,7 @@ impl &RWARC { * in write mode. */ // FIXME(#2585) make this a by-move method on the arc -fn unwrap_rw_arc(+arc: RWARC) -> T { +pub fn unwrap_rw_arc(+arc: RWARC) -> T { let RWARC { x: x, _ } <- arc; let inner = unsafe { unwrap_shared_mutable_state(move x) }; let RWARCInner { failed: failed, data: data, _ } <- inner; @@ -395,10 +390,10 @@ fn borrow_rwlock(state: &r/mut RWARCInner) -> &r/RWlock { // FIXME (#3154) ice with struct/& prevents these from being structs. /// The "write permission" token used for RWARC.write_downgrade(). -enum RWWriteMode = +pub enum RWWriteMode = (&mut T, sync::RWlockWriteMode, PoisonOnFail); /// The "read permission" token used for RWARC.write_downgrade(). -enum RWReadMode = (&T, sync::RWlockReadMode); +pub enum RWReadMode = (&T, sync::RWlockReadMode); impl &RWWriteMode { /// Access the pre-downgrade RWARC in write mode. diff --git a/src/libstd/comm.rs b/src/libstd/comm.rs index 58958d6115e..4bed7d13d0b 100644 --- a/src/libstd/comm.rs +++ b/src/libstd/comm.rs @@ -9,10 +9,8 @@ Higher level communication abstractions. use pipes::{Channel, Recv, Chan, Port, Selectable}; -export DuplexStream; - /// An extension of `pipes::stream` that allows both sending and receiving. -struct DuplexStream { +pub struct DuplexStream { priv chan: Chan, priv port: Port , } diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 13f7b967723..798ae4be6dd 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -74,11 +74,8 @@ mod cell; // Concurrency -#[legacy_exports] mod sync; -#[legacy_exports] mod arc; -#[legacy_exports] mod comm; // Collections diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index c94a1ab46bf..2b2cd2b0ba7 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -7,9 +7,6 @@ * in std. */ -export Condvar, Semaphore, Mutex, mutex_with_condvars; -export RWlock, rwlock_with_condvars, RWlockReadMode, RWlockWriteMode; - use private::{Exclusive, exclusive}; /**************************************************************************** @@ -176,7 +173,7 @@ fn SemAndSignalRelease(sem: &r/Sem<~[mut Waitqueue]>) } /// A mechanism for atomic-unlock-and-deschedule blocking and signalling. -struct Condvar { priv sem: &Sem<~[mut Waitqueue]>, drop { } } +pub struct Condvar { priv sem: &Sem<~[mut Waitqueue]>, drop { } } impl &Condvar { /** @@ -379,14 +376,14 @@ impl &Semaphore { struct Mutex { priv sem: Sem<~[mut Waitqueue]> } /// Create a new mutex, with one associated condvar. -fn Mutex() -> Mutex { mutex_with_condvars(1) } +pub fn Mutex() -> Mutex { mutex_with_condvars(1) } /** * Create a new mutex, with a specified number of associated condvars. This * will allow calling wait_on/signal_on/broadcast_on with condvar IDs between * 0 and num_condvars-1. (If num_condvars is 0, lock_cond will be allowed but * any operations on the condvar will fail.) */ -fn mutex_with_condvars(num_condvars: uint) -> Mutex { +pub fn mutex_with_condvars(num_condvars: uint) -> Mutex { Mutex { sem: new_sem_and_signal(1, num_condvars) } } @@ -429,13 +426,13 @@ struct RWlock { } /// Create a new rwlock, with one associated condvar. -fn RWlock() -> RWlock { rwlock_with_condvars(1) } +pub fn RWlock() -> RWlock { rwlock_with_condvars(1) } /** * Create a new rwlock, with a specified number of associated condvars. * Similar to mutex_with_condvars. */ -fn rwlock_with_condvars(num_condvars: uint) -> RWlock { +pub fn rwlock_with_condvars(num_condvars: uint) -> RWlock { RWlock { order_lock: semaphore(1), access_lock: new_sem_and_signal(1, num_condvars), state: exclusive(RWlockInner { read_mode: false, @@ -646,9 +643,9 @@ fn RWlockReleaseDowngrade(lock: &r/RWlock) -> RWlockReleaseDowngrade/&r { } /// The "write permission" token used for rwlock.write_downgrade(). -struct RWlockWriteMode { /* priv */ lock: &RWlock, drop { } } +pub struct RWlockWriteMode { /* priv */ lock: &RWlock, drop { } } /// The "read permission" token used for rwlock.write_downgrade(). -struct RWlockReadMode { priv lock: &RWlock, drop { } } +pub struct RWlockReadMode { priv lock: &RWlock, drop { } } impl &RWlockWriteMode { /// Access the pre-downgrade rwlock in write mode.