stackaddr as uint + guardsize as uint
}
+
+ #[cfg(target_os = "bitrig")]
+ pub unsafe fn current() -> uint {
+ let mut current_stack: stack_t = mem::zeroed();
+ if pthread_stackseg_np(pthread_self(), &mut current_stack) != 0 {
+ panic!("failed to get current stack: pthread_stackseg_np")
+ }
+
+ if pthread_main_np() == 1 {
+ // main thread
+ current_stack.ss_sp as uint - current_stack.ss_size as uint + 3 * PAGE_SIZE as uint
+ } else {
+ // new thread
+ current_stack.ss_sp as uint - current_stack.ss_size as uint
+ }
+ }
}
-pub unsafe fn create(stack: uint, p: Thunk) -> rust_thread {
+pub unsafe fn create(stack: uint, p: Thunk) -> io::Result<rust_thread> {
let mut native: libc::pthread_t = mem::zeroed();
let mut attr: libc::pthread_attr_t = mem::zeroed();
assert_eq!(pthread_attr_init(&mut attr), 0);