@@ -11,14 +11,9 @@ use private::{SharedMutableState, shared_mutable_state,
11
11
use sync:: { Mutex , mutex_with_condvars,
12
12
RWlock , rwlock_with_condvars} ;
13
13
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;
19
14
20
15
/// 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 }
22
17
23
18
impl & Condvar {
24
19
/// Atomically exit the associated ARC and block until a signal is sent.
@@ -71,15 +66,15 @@ impl &Condvar {
71
66
struct ARC < T : Const Send > { x : SharedMutableState < T > }
72
67
73
68
/// 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 > {
75
70
ARC { x : unsafe { shared_mutable_state ( move data) } }
76
71
}
77
72
78
73
/**
79
74
* Access the underlying data in an atomically reference counted
80
75
* wrapper.
81
76
*/
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 {
83
78
unsafe { get_shared_immutable_state ( & rc. x ) }
84
79
}
85
80
@@ -90,7 +85,7 @@ fn get<T: Const Send>(rc: &a/ARC<T>) -> &a/T {
90
85
* object. However, one of the `arc` objects can be sent to another task,
91
86
* allowing them to share the underlying data.
92
87
*/
93
- fn clone < T : Const Send > ( rc : & ARC < T > ) -> ARC < T > {
88
+ pub fn clone < T : Const Send > ( rc : & ARC < T > ) -> ARC < T > {
94
89
ARC { x : unsafe { clone_shared_mutable_state ( & rc. x ) } }
95
90
}
96
91
@@ -118,14 +113,14 @@ struct MutexARCInner<T: Send> { lock: Mutex, failed: bool, data: T }
118
113
struct MutexARC < T : Send > { x : SharedMutableState < MutexARCInner < T > > }
119
114
120
115
/// 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 > {
122
117
mutex_arc_with_condvars ( move user_data, 1 )
123
118
}
124
119
/**
125
120
* Create a mutex-protected ARC with the supplied data and a specified number
126
121
* of condvars (as sync::mutex_with_condvars).
127
122
*/
128
- fn mutex_arc_with_condvars < T : Send > ( +user_data : T ,
123
+ pub fn mutex_arc_with_condvars < T : Send > ( +user_data : T ,
129
124
num_condvars : uint ) -> MutexARC < T > {
130
125
let data =
131
126
MutexARCInner { lock : mutex_with_condvars ( num_condvars) ,
@@ -196,7 +191,7 @@ impl<T: Send> &MutexARC<T> {
196
191
* Will additionally fail if another task has failed while accessing the arc.
197
192
*/
198
193
// 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 {
200
195
let MutexARC { x : x } <- arc;
201
196
let inner = unsafe { unwrap_shared_mutable_state ( move x) } ;
202
197
let MutexARCInner { failed : failed, data : data, _ } <- inner;
@@ -252,14 +247,14 @@ struct RWARC<T: Const Send> {
252
247
}
253
248
254
249
/// 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> {
256
251
rw_arc_with_condvars(move user_data, 1)
257
252
}
258
253
/**
259
254
* Create a reader/writer ARC with the supplied data and a specified number
260
255
* of condvars (as sync::rwlock_with_condvars).
261
256
*/
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,
263
258
num_condvars: uint) -> RWARC<T> {
264
259
let data =
265
260
RWARCInner { lock: rwlock_with_condvars(num_condvars),
@@ -374,7 +369,7 @@ impl<T: Const Send> &RWARC<T> {
374
369
* in write mode.
375
370
*/
376
371
// 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 {
378
373
let RWARC { x: x, _ } <- arc;
379
374
let inner = unsafe { unwrap_shared_mutable_state(move x) };
380
375
let RWARCInner { failed: failed, data: data, _ } <- inner;
@@ -395,10 +390,10 @@ fn borrow_rwlock<T: Const Send>(state: &r/mut RWARCInner<T>) -> &r/RWlock {
395
390
// FIXME (#3154) ice with struct/&<T> prevents these from being structs.
396
391
397
392
/// The " write permission" token used for RWARC . write_downgrade ( ) .
398
- enum RWWriteMode <T : Const Send > =
393
+ pub enum RWWriteMode <T : Const Send > =
399
394
( & mut T , sync:: RWlockWriteMode , PoisonOnFail ) ;
400
395
/// 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 ) ;
402
397
403
398
impl < T : Const Send > & RWWriteMode < T > {
404
399
/// Access the pre-downgrade RWARC in write mode.
0 commit comments