Skip to content

Commit 563aa0b

Browse files
committed
Remove the last use of rustrt::rust_compare_and_swap_ptr
Closes #3527 r=brson
1 parent a006608 commit 563aa0b

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/libcore/private.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ extern mod rustrt {
1313
fn rust_task_weaken(ch: rust_port_id);
1414
fn rust_task_unweaken(ch: rust_port_id);
1515

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-
2116
fn rust_create_little_lock() -> rust_little_lock;
2217
fn rust_destroy_little_lock(lock: rust_little_lock);
2318
fn rust_lock_little_lock(lock: rust_little_lock);
@@ -291,11 +286,11 @@ pub fn test_weaken_task_fail() {
291286
// An unwrapper uses this protocol to communicate with the "other" task that
292287
// drops the last refcount on an arc. Unfortunately this can't be a proper
293288
// 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>)>;
295290

296291
struct ArcData<T> {
297292
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
299294
// FIXME(#3224) should be able to make this non-option to save memory, and
300295
// in unwrap() use "let ~ArcData { data: result, _ } = thing" to unwrap it
301296
mut data: Option<T>,
@@ -371,9 +366,9 @@ pub unsafe fn unwrap_shared_mutable_state<T: Send>(rc: SharedMutableState<T>)
371366
let (c1,p1) = pipes::oneshot(); // ()
372367
let (c2,p2) = pipes::oneshot(); // bool
373368
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);
375370
// 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) {
377372
// Got in. Step 0: Tell destructor not to run. We are now it.
378373
rc.data = ptr::null();
379374
// Step 1 - drop our own reference.

0 commit comments

Comments
 (0)