@@ -205,50 +205,6 @@ extern {
205
205
fn rust_unlock_little_lock ( lock : rust_little_lock ) ;
206
206
}
207
207
208
- /* *********************************************************************/
209
-
210
- //FIXME: #5042 This should be replaced by proper atomic type
211
- pub struct AtomicUint {
212
- priv inner : uint
213
- }
214
-
215
- impl AtomicUint {
216
- pub fn new ( val : uint ) -> AtomicUint { AtomicUint { inner : val } }
217
- pub fn load ( & self ) -> uint {
218
- unsafe { intrinsics:: atomic_load ( cast:: transmute ( self ) ) as uint }
219
- }
220
- pub fn store ( & mut self , val : uint ) {
221
- unsafe { intrinsics:: atomic_store ( cast:: transmute ( self ) , val as int ) ; }
222
- }
223
- pub fn add ( & mut self , val : int ) -> uint {
224
- unsafe { intrinsics:: atomic_xadd ( cast:: transmute ( self ) , val as int ) as uint }
225
- }
226
- pub fn cas ( & mut self , old : uint , new : uint ) -> uint {
227
- unsafe { intrinsics:: atomic_cxchg ( cast:: transmute ( self ) , old as int , new as int ) as uint }
228
- }
229
- }
230
-
231
- pub struct AtomicInt {
232
- priv inner : int
233
- }
234
-
235
- impl AtomicInt {
236
- pub fn new ( val : int ) -> AtomicInt { AtomicInt { inner : val } }
237
- pub fn load ( & self ) -> int {
238
- unsafe { intrinsics:: atomic_load ( & self . inner ) }
239
- }
240
- pub fn store ( & mut self , val : int ) {
241
- unsafe { intrinsics:: atomic_store ( & mut self . inner , val) ; }
242
- }
243
- pub fn add ( & mut self , val : int ) -> int {
244
- unsafe { intrinsics:: atomic_xadd ( & mut self . inner , val) }
245
- }
246
- pub fn cas ( & mut self , old : int , new : int ) -> int {
247
- unsafe { intrinsics:: atomic_cxchg ( & mut self . inner , old, new) }
248
- }
249
- }
250
-
251
-
252
208
#[ cfg( test) ]
253
209
mod tests {
254
210
use super :: * ;
@@ -307,28 +263,4 @@ mod tests {
307
263
}
308
264
}
309
265
}
310
-
311
- #[ test]
312
- fn atomic_int_smoke_test ( ) {
313
- let mut i = AtomicInt :: new ( 0 ) ;
314
- i. store ( 10 ) ;
315
- assert ! ( i. load( ) == 10 ) ;
316
- assert ! ( i. add( 1 ) == 10 ) ;
317
- assert ! ( i. load( ) == 11 ) ;
318
- assert ! ( i. cas( 11 , 12 ) == 11 ) ;
319
- assert ! ( i. cas( 11 , 13 ) == 12 ) ;
320
- assert ! ( i. load( ) == 12 ) ;
321
- }
322
-
323
- #[ test]
324
- fn atomic_uint_smoke_test ( ) {
325
- let mut i = AtomicUint :: new ( 0 ) ;
326
- i. store ( 10 ) ;
327
- assert ! ( i. load( ) == 10 ) ;
328
- assert ! ( i. add( 1 ) == 10 ) ;
329
- assert ! ( i. load( ) == 11 ) ;
330
- assert ! ( i. cas( 11 , 12 ) == 11 ) ;
331
- assert ! ( i. cas( 11 , 13 ) == 12 ) ;
332
- assert ! ( i. load( ) == 12 ) ;
333
- }
334
266
}
0 commit comments