Skip to content

Commit 43a9d90

Browse files
committed
De-export std::{arc,comm,sync}. Part of #3583.
1 parent 4b7d4cd commit 43a9d90

File tree

4 files changed

+20
-33
lines changed

4 files changed

+20
-33
lines changed

src/libstd/arc.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,9 @@ use private::{SharedMutableState, shared_mutable_state,
1111
use sync::{Mutex, mutex_with_condvars,
1212
RWlock, rwlock_with_condvars};
1313

14-
export ARC, clone, get;
15-
export Condvar;
16-
export MutexARC, mutex_arc_with_condvars, unwrap_mutex_arc;
17-
export RWARC, rw_arc_with_condvars, RWWriteMode, RWReadMode;
18-
export unwrap_rw_arc;
1914

2015
/// As sync::condvar, a mechanism for unlock-and-descheduling and signalling.
21-
struct Condvar { is_mutex: bool, failed: &mut bool, cond: &sync::Condvar }
16+
pub struct Condvar { is_mutex: bool, failed: &mut bool, cond: &sync::Condvar }
2217

2318
impl &Condvar {
2419
/// Atomically exit the associated ARC and block until a signal is sent.
@@ -71,15 +66,15 @@ impl &Condvar {
7166
struct ARC<T: Const Send> { x: SharedMutableState<T> }
7267

7368
/// Create an atomically reference counted wrapper.
74-
fn ARC<T: Const Send>(+data: T) -> ARC<T> {
69+
pub fn ARC<T: Const Send>(+data: T) -> ARC<T> {
7570
ARC { x: unsafe { shared_mutable_state(move data) } }
7671
}
7772

7873
/**
7974
* Access the underlying data in an atomically reference counted
8075
* wrapper.
8176
*/
82-
fn get<T: Const Send>(rc: &a/ARC<T>) -> &a/T {
77+
pub fn get<T: Const Send>(rc: &a/ARC<T>) -> &a/T {
8378
unsafe { get_shared_immutable_state(&rc.x) }
8479
}
8580

@@ -90,7 +85,7 @@ fn get<T: Const Send>(rc: &a/ARC<T>) -> &a/T {
9085
* object. However, one of the `arc` objects can be sent to another task,
9186
* allowing them to share the underlying data.
9287
*/
93-
fn clone<T: Const Send>(rc: &ARC<T>) -> ARC<T> {
88+
pub fn clone<T: Const Send>(rc: &ARC<T>) -> ARC<T> {
9489
ARC { x: unsafe { clone_shared_mutable_state(&rc.x) } }
9590
}
9691

@@ -118,14 +113,14 @@ struct MutexARCInner<T: Send> { lock: Mutex, failed: bool, data: T }
118113
struct MutexARC<T: Send> { x: SharedMutableState<MutexARCInner<T>> }
119114

120115
/// Create a mutex-protected ARC with the supplied data.
121-
fn MutexARC<T: Send>(+user_data: T) -> MutexARC<T> {
116+
pub fn MutexARC<T: Send>(+user_data: T) -> MutexARC<T> {
122117
mutex_arc_with_condvars(move user_data, 1)
123118
}
124119
/**
125120
* Create a mutex-protected ARC with the supplied data and a specified number
126121
* of condvars (as sync::mutex_with_condvars).
127122
*/
128-
fn mutex_arc_with_condvars<T: Send>(+user_data: T,
123+
pub fn mutex_arc_with_condvars<T: Send>(+user_data: T,
129124
num_condvars: uint) -> MutexARC<T> {
130125
let data =
131126
MutexARCInner { lock: mutex_with_condvars(num_condvars),
@@ -196,7 +191,7 @@ impl<T: Send> &MutexARC<T> {
196191
* Will additionally fail if another task has failed while accessing the arc.
197192
*/
198193
// FIXME(#2585) make this a by-move method on the arc
199-
fn unwrap_mutex_arc<T: Send>(+arc: MutexARC<T>) -> T {
194+
pub fn unwrap_mutex_arc<T: Send>(+arc: MutexARC<T>) -> T {
200195
let MutexARC { x: x } <- arc;
201196
let inner = unsafe { unwrap_shared_mutable_state(move x) };
202197
let MutexARCInner { failed: failed, data: data, _ } <- inner;
@@ -252,14 +247,14 @@ struct RWARC<T: Const Send> {
252247
}
253248
254249
/// Create a reader/writer ARC with the supplied data.
255-
fn RWARC<T: Const Send>(+user_data: T) -> RWARC<T> {
250+
pub fn RWARC<T: Const Send>(+user_data: T) -> RWARC<T> {
256251
rw_arc_with_condvars(move user_data, 1)
257252
}
258253
/**
259254
* Create a reader/writer ARC with the supplied data and a specified number
260255
* of condvars (as sync::rwlock_with_condvars).
261256
*/
262-
fn rw_arc_with_condvars<T: Const Send>(+user_data: T,
257+
pub fn rw_arc_with_condvars<T: Const Send>(+user_data: T,
263258
num_condvars: uint) -> RWARC<T> {
264259
let data =
265260
RWARCInner { lock: rwlock_with_condvars(num_condvars),
@@ -374,7 +369,7 @@ impl<T: Const Send> &RWARC<T> {
374369
* in write mode.
375370
*/
376371
// FIXME(#2585) make this a by-move method on the arc
377-
fn unwrap_rw_arc<T: Const Send>(+arc: RWARC<T>) -> T {
372+
pub fn unwrap_rw_arc<T: Const Send>(+arc: RWARC<T>) -> T {
378373
let RWARC { x: x, _ } <- arc;
379374
let inner = unsafe { unwrap_shared_mutable_state(move x) };
380375
let RWARCInner { failed: failed, data: data, _ } <- inner;
@@ -395,10 +390,10 @@ fn borrow_rwlock<T: Const Send>(state: &r/mut RWARCInner<T>) -> &r/RWlock {
395390
// FIXME (#3154) ice with struct/&<T> prevents these from being structs.
396391
397392
/// The "write permission" token used for RWARC.write_downgrade().
398-
enum RWWriteMode<T: Const Send> =
393+
pub enum RWWriteMode<T: Const Send> =
399394
(&mut T, sync::RWlockWriteMode, PoisonOnFail);
400395
/// The "read permission" token used for RWARC.write_downgrade().
401-
enum RWReadMode<T:Const Send> = (&T, sync::RWlockReadMode);
396+
pub enum RWReadMode<T:Const Send> = (&T, sync::RWlockReadMode);
402397

403398
impl<T: Const Send> &RWWriteMode<T> {
404399
/// Access the pre-downgrade RWARC in write mode.

src/libstd/comm.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ Higher level communication abstractions.
99

1010
use pipes::{Channel, Recv, Chan, Port, Selectable};
1111

12-
export DuplexStream;
13-
1412
/// An extension of `pipes::stream` that allows both sending and receiving.
15-
struct DuplexStream<T: Send, U: Send> {
13+
pub struct DuplexStream<T: Send, U: Send> {
1614
priv chan: Chan<T>,
1715
priv port: Port <U>,
1816
}

src/libstd/std.rc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,8 @@ mod cell;
7474

7575
// Concurrency
7676

77-
#[legacy_exports]
7877
mod sync;
79-
#[legacy_exports]
8078
mod arc;
81-
#[legacy_exports]
8279
mod comm;
8380

8481
// Collections

src/libstd/sync.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* in std.
88
*/
99

10-
export Condvar, Semaphore, Mutex, mutex_with_condvars;
11-
export RWlock, rwlock_with_condvars, RWlockReadMode, RWlockWriteMode;
12-
1310
use private::{Exclusive, exclusive};
1411

1512
/****************************************************************************
@@ -176,7 +173,7 @@ fn SemAndSignalRelease(sem: &r/Sem<~[mut Waitqueue]>)
176173
}
177174

178175
/// A mechanism for atomic-unlock-and-deschedule blocking and signalling.
179-
struct Condvar { priv sem: &Sem<~[mut Waitqueue]>, drop { } }
176+
pub struct Condvar { priv sem: &Sem<~[mut Waitqueue]>, drop { } }
180177

181178
impl &Condvar {
182179
/**
@@ -379,14 +376,14 @@ impl &Semaphore {
379376
struct Mutex { priv sem: Sem<~[mut Waitqueue]> }
380377

381378
/// Create a new mutex, with one associated condvar.
382-
fn Mutex() -> Mutex { mutex_with_condvars(1) }
379+
pub fn Mutex() -> Mutex { mutex_with_condvars(1) }
383380
/**
384381
* Create a new mutex, with a specified number of associated condvars. This
385382
* will allow calling wait_on/signal_on/broadcast_on with condvar IDs between
386383
* 0 and num_condvars-1. (If num_condvars is 0, lock_cond will be allowed but
387384
* any operations on the condvar will fail.)
388385
*/
389-
fn mutex_with_condvars(num_condvars: uint) -> Mutex {
386+
pub fn mutex_with_condvars(num_condvars: uint) -> Mutex {
390387
Mutex { sem: new_sem_and_signal(1, num_condvars) }
391388
}
392389

@@ -429,13 +426,13 @@ struct RWlock {
429426
}
430427

431428
/// Create a new rwlock, with one associated condvar.
432-
fn RWlock() -> RWlock { rwlock_with_condvars(1) }
429+
pub fn RWlock() -> RWlock { rwlock_with_condvars(1) }
433430

434431
/**
435432
* Create a new rwlock, with a specified number of associated condvars.
436433
* Similar to mutex_with_condvars.
437434
*/
438-
fn rwlock_with_condvars(num_condvars: uint) -> RWlock {
435+
pub fn rwlock_with_condvars(num_condvars: uint) -> RWlock {
439436
RWlock { order_lock: semaphore(1),
440437
access_lock: new_sem_and_signal(1, num_condvars),
441438
state: exclusive(RWlockInner { read_mode: false,
@@ -646,9 +643,9 @@ fn RWlockReleaseDowngrade(lock: &r/RWlock) -> RWlockReleaseDowngrade/&r {
646643
}
647644
648645
/// The "write permission" token used for rwlock.write_downgrade().
649-
struct RWlockWriteMode { /* priv */ lock: &RWlock, drop { } }
646+
pub struct RWlockWriteMode { /* priv */ lock: &RWlock, drop { } }
650647
/// The "read permission" token used for rwlock.write_downgrade().
651-
struct RWlockReadMode { priv lock: &RWlock, drop { } }
648+
pub struct RWlockReadMode { priv lock: &RWlock, drop { } }
652649

653650
impl &RWlockWriteMode {
654651
/// Access the pre-downgrade rwlock in write mode.

0 commit comments

Comments
 (0)