mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 07:03:45 +00:00
Merge two THREAD_INFO.with and following RefCell borrow
This is a bit faster
This commit is contained in:
parent
cb14269145
commit
5e7f641a32
@ -39,6 +39,9 @@ pub fn stack_guard() -> Option<Guard> {
|
||||
}
|
||||
|
||||
pub fn set(stack_guard: Option<Guard>, thread: Thread) {
|
||||
THREAD_INFO.with(|c| rtassert!(c.borrow().is_none()));
|
||||
THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo { stack_guard, thread }));
|
||||
THREAD_INFO.with(move |thread_info| {
|
||||
let mut thread_info = thread_info.borrow_mut();
|
||||
rtassert!(thread_info.is_none());
|
||||
*thread_info = Some(ThreadInfo { stack_guard, thread });
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user