Skip to content

Commit 4541c6c

Browse files
committed
rt: Remove exit_status helpers
1 parent b4ef59d commit 4541c6c

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

src/libstd/rt/util.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use libc;
1414
use option::{Some, None};
1515
use os;
1616
use str::StrSlice;
17+
use unstable::atomics::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
1718

1819
#[cfg(target_os="macos")]
1920
use unstable::running_on_valgrind;
@@ -129,24 +130,12 @@ memory and partly incapable of presentation to others.",
129130
}
130131
}
131132

132-
pub fn set_exit_status(code: int) {
133-
#[fixed_stack_segment]; #[inline(never)];
134-
unsafe {
135-
return rust_set_exit_status_newrt(code as libc::uintptr_t);
136-
}
133+
static mut EXIT_STATUS: AtomicInt = INIT_ATOMIC_INT;
137134

138-
extern {
139-
fn rust_set_exit_status_newrt(code: libc::uintptr_t);
140-
}
135+
pub fn set_exit_status(code: int) {
136+
unsafe { EXIT_STATUS.store(code, SeqCst) }
141137
}
142138

143139
pub fn get_exit_status() -> int {
144-
#[fixed_stack_segment]; #[inline(never)];
145-
unsafe {
146-
return rust_get_exit_status_newrt() as int;
147-
}
148-
149-
extern {
150-
fn rust_get_exit_status_newrt() -> libc::uintptr_t;
151-
}
140+
unsafe { EXIT_STATUS.load(SeqCst) }
152141
}

src/rt/rust_builtin.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -653,21 +653,6 @@ rust_get_global_args_ptr() {
653653
return &global_args_ptr;
654654
}
655655

656-
static lock_and_signal exit_status_lock;
657-
static uintptr_t exit_status = 0;
658-
659-
extern "C" CDECL void
660-
rust_set_exit_status_newrt(uintptr_t code) {
661-
scoped_lock with(exit_status_lock);
662-
exit_status = code;
663-
}
664-
665-
extern "C" CDECL uintptr_t
666-
rust_get_exit_status_newrt() {
667-
scoped_lock with(exit_status_lock);
668-
return exit_status;
669-
}
670-
671656
static lock_and_signal change_dir_lock;
672657

673658
extern "C" CDECL void

src/rt/rustrt.def.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ rust_get_num_cpus
191191
rust_get_global_args_ptr
192192
rust_take_global_args_lock
193193
rust_drop_global_args_lock
194-
rust_set_exit_status_newrt
195-
rust_get_exit_status_newrt
196194
rust_take_change_dir_lock
197195
rust_drop_change_dir_lock
198196
rust_get_test_int

0 commit comments

Comments
 (0)