From d08600b189eeb2e61879b44a07f9fdc33fa82689 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 17 Dec 2014 14:59:20 -0800 Subject: std: Move the panic flag to its own thread local This flag is somewhat tied to the `unwind` module rather than the `thread_info` module, so this commit moves it into that module as well as allowing the same OS thread to call `unwind::try` multiple times. Previously once a thread panicked its panic flag was never reset, even after exiting the panic handler. --- src/libstd/sys/common/thread_info.rs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/common/thread_info.rs b/src/libstd/sys/common/thread_info.rs index 92a896c7583..0519bc56f0a 100644 --- a/src/libstd/sys/common/thread_info.rs +++ b/src/libstd/sys/common/thread_info.rs @@ -20,7 +20,6 @@ struct ThreadInfo { // hence this is optional. stack_bounds: (uint, uint), stack_guard: uint, - unwinding: bool, thread: Thread, } @@ -38,7 +37,6 @@ impl ThreadInfo { *c.borrow_mut() = Some(ThreadInfo { stack_bounds: (0, 0), stack_guard: 0, - unwinding: false, thread: NewThread::new(None), }) } @@ -51,24 +49,15 @@ pub fn current_thread() -> Thread { ThreadInfo::with(|info| info.thread.clone()) } -pub fn panicking() -> bool { - ThreadInfo::with(|info| info.unwinding) -} - pub fn stack_guard() -> uint { ThreadInfo::with(|info| info.stack_guard) } -pub fn set_unwinding(unwinding: bool) { - ThreadInfo::with(|info| info.unwinding = unwinding) -} - pub fn set(stack_bounds: (uint, uint), stack_guard: uint, thread: Thread) { THREAD_INFO.with(|c| assert!(c.borrow().is_none())); THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo{ stack_bounds: stack_bounds, stack_guard: stack_guard, - unwinding: false, thread: thread, })); } -- cgit 1.4.1-3-g733a5