Auto merge of #123550 - GnomedDev:remove-initial-arc, r=Noratrieb
Remove the `Arc` rt::init allocation for thread info Removes an allocation pre-main by just not storing anything in std:🧵:Thread for the main thread. - The thread name can just be a hard coded literal, as was done in #123433. - Storing ThreadId and Parker in a static that is initialized once at startup. This uses SyncUnsafeCell and MaybeUninit as this is quite performance critical and we don't need synchronization or to store a tag value and possibly leave in a panic.
This commit is contained in:
commit
f61306d47b
5 changed files with 124 additions and 58 deletions
|
@ -12,15 +12,15 @@
|
|||
// cdb-check:join_handle,d [Type: std::thread::JoinHandle<tuple$<> >]
|
||||
// cdb-check: [...] __0 [Type: std::thread::JoinInner<tuple$<> >]
|
||||
//
|
||||
// cdb-command:dx t,d
|
||||
// cdb-command:dx -r3 t,d
|
||||
// cdb-check:t,d : [...] [Type: std::thread::Thread *]
|
||||
// cdb-check:[...] inner [...][Type: core::pin::Pin<alloc::sync::Arc<std::thread::Inner,alloc::alloc::Global> >]
|
||||
// cdb-check: [...] __0 : Other [Type: enum2$<std::thread::Inner>]
|
||||
// cdb-check: [...] __0 [Type: core::pin::Pin<alloc::sync::Arc<std::thread::OtherInner,[...]> >]
|
||||
|
||||
use std::thread;
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn main()
|
||||
{
|
||||
fn main() {
|
||||
let join_handle = thread::spawn(|| {
|
||||
println!("Initialize a thread");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue