File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,26 @@ 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 ( uint ) ;
212
+ pub impl AtomicUint {
213
+ fn load ( & self ) -> uint {
214
+ unsafe { intrinsics:: atomic_load ( cast:: transmute ( self ) ) as uint }
215
+ }
216
+ fn store ( & mut self , val : uint ) {
217
+ unsafe { intrinsics:: atomic_store ( cast:: transmute ( self ) , val as int ) ; }
218
+ }
219
+ fn add ( & mut self , val : int ) -> uint {
220
+ unsafe { intrinsics:: atomic_xadd ( cast:: transmute ( self ) , val as int ) as uint }
221
+ }
222
+ fn cas ( & self , old : uint , new : uint ) -> uint {
223
+ unsafe { intrinsics:: atomic_cxchg ( cast:: transmute ( self ) , old as int , new as int ) as uint }
224
+ }
225
+ }
226
+
227
+
208
228
#[ cfg( test) ]
209
229
mod tests {
210
230
use comm;
You can’t perform that action at this time.
0 commit comments