From 4541c6cfe3ee875020329f888c39ea75183b23d1 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 22 Aug 2013 22:55:11 -0700 Subject: [PATCH] rt: Remove exit_status helpers --- src/libstd/rt/util.rs | 21 +++++---------------- src/rt/rust_builtin.cpp | 15 --------------- src/rt/rustrt.def.in | 2 -- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 1f29830aa04..f2ede8872c2 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -14,6 +14,7 @@ use libc; use option::{Some, None}; use os; use str::StrSlice; +use unstable::atomics::{AtomicInt, INIT_ATOMIC_INT, SeqCst}; #[cfg(target_os="macos")] use unstable::running_on_valgrind; @@ -129,24 +130,12 @@ memory and partly incapable of presentation to others.", } } -pub fn set_exit_status(code: int) { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { - return rust_set_exit_status_newrt(code as libc::uintptr_t); - } +static mut EXIT_STATUS: AtomicInt = INIT_ATOMIC_INT; - extern { - fn rust_set_exit_status_newrt(code: libc::uintptr_t); - } +pub fn set_exit_status(code: int) { + unsafe { EXIT_STATUS.store(code, SeqCst) } } pub fn get_exit_status() -> int { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { - return rust_get_exit_status_newrt() as int; - } - - extern { - fn rust_get_exit_status_newrt() -> libc::uintptr_t; - } + unsafe { EXIT_STATUS.load(SeqCst) } } diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 784693755c5..3a2a8e89415 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -653,21 +653,6 @@ rust_get_global_args_ptr() { return &global_args_ptr; } -static lock_and_signal exit_status_lock; -static uintptr_t exit_status = 0; - -extern "C" CDECL void -rust_set_exit_status_newrt(uintptr_t code) { - scoped_lock with(exit_status_lock); - exit_status = code; -} - -extern "C" CDECL uintptr_t -rust_get_exit_status_newrt() { - scoped_lock with(exit_status_lock); - return exit_status; -} - static lock_and_signal change_dir_lock; extern "C" CDECL void diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 5100e732308..54b6dc2c602 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -191,8 +191,6 @@ rust_get_num_cpus rust_get_global_args_ptr rust_take_global_args_lock rust_drop_global_args_lock -rust_set_exit_status_newrt -rust_get_exit_status_newrt rust_take_change_dir_lock rust_drop_change_dir_lock rust_get_test_int