@@ -13,11 +13,6 @@ extern mod rustrt {
13
13
fn rust_task_weaken ( ch : rust_port_id ) ;
14
14
fn rust_task_unweaken ( ch : rust_port_id ) ;
15
15
16
- #[ rust_stack]
17
- fn rust_compare_and_swap_ptr ( address : & mut libc:: uintptr_t ,
18
- oldval : libc:: uintptr_t ,
19
- newval : libc:: uintptr_t ) -> bool ;
20
-
21
16
fn rust_create_little_lock ( ) -> rust_little_lock ;
22
17
fn rust_destroy_little_lock ( lock : rust_little_lock ) ;
23
18
fn rust_lock_little_lock ( lock : rust_little_lock ) ;
@@ -291,11 +286,11 @@ pub fn test_weaken_task_fail() {
291
286
// An unwrapper uses this protocol to communicate with the "other" task that
292
287
// drops the last refcount on an arc. Unfortunately this can't be a proper
293
288
// pipe protocol because the unwrapper has to access both stages at once.
294
- type UnwrapProto = ~mut Option <( pipes:: ChanOne <( ) >, pipes:: PortOne <bool >) >;
289
+ type UnwrapProto = ~mut Option <( pipes:: ChanOne <( ) >, pipes:: PortOne <bool >) >;
295
290
296
291
struct ArcData <T > {
297
292
mut count: libc:: intptr_t,
298
- mut unwrapper: libc :: uintptr_t , // either a UnwrapProto or 0
293
+ mut unwrapper: int , // either a UnwrapProto or 0
299
294
// FIXME(#3224) should be able to make this non-option to save memory, and
300
295
// in unwrap() use "let ~ArcData { data: result, _ } = thing" to unwrap it
301
296
mut data: Option <T >,
@@ -371,9 +366,9 @@ pub unsafe fn unwrap_shared_mutable_state<T: Send>(rc: SharedMutableState<T>)
371
366
let ( c1, p1) = pipes:: oneshot( ) ; // ()
372
367
let ( c2, p2) = pipes:: oneshot( ) ; // bool
373
368
let server: UnwrapProto = ~mut Some ( ( move c1, move p2) ) ;
374
- let serverp: libc :: uintptr_t = cast:: transmute( move server) ;
369
+ let serverp: int = cast:: transmute( move server) ;
375
370
// Try to put our server end in the unwrapper slot.
376
- if rustrt :: rust_compare_and_swap_ptr ( & mut ptr. unwrapper, 0 , serverp) {
371
+ if compare_and_swap ( & mut ptr. unwrapper, 0 , serverp) {
377
372
// Got in. Step 0: Tell destructor not to run. We are now it.
378
373
rc. data = ptr:: null( ) ;
379
374
// Step 1 - drop our own reference.
0 commit comments