std: refactor the TLS implementation · rust-lang/rust@f3facf1

File tree

50 files changed

lines changed

  • src/tools/miri/tests/pass-dep/concurrency

50 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -33,9 +33,6 @@ pub mod pipe;

3333

pub mod process;

3434

pub mod stdio;

3535

pub mod thread;

36-

pub mod thread_local_dtor;

37-

#[path = "../unsupported/thread_local_key.rs"]

38-

pub mod thread_local_key;

3936

pub mod time;

4037
4138

use crate::io::ErrorKind;

@@ -98,7 +95,6 @@ pub unsafe extern "C" fn runtime_entry(

9895

argv: *const *const c_char,

9996

env: *const *const c_char,

10097

) -> ! {

101-

use thread_local_dtor::run_dtors;

10298

extern "C" {

10399

fn main(argc: isize, argv: *const *const c_char) -> i32;

104100

}

@@ -108,7 +104,7 @@ pub unsafe extern "C" fn runtime_entry(

108104
109105

let result = main(argc as isize, argv);

110106
111-

run_dtors();

107+

crate::sys::thread_local::destructors::run();

112108

hermit_abi::exit(result);

113109

}

114110
Original file line numberDiff line numberDiff line change

@@ -1,7 +1,6 @@

11

#![allow(dead_code)]

22
33

use super::hermit_abi;

4-

use super::thread_local_dtor::run_dtors;

54

use crate::ffi::CStr;

65

use crate::io;

76

use crate::mem;

@@ -50,7 +49,7 @@ impl Thread {

5049

Box::from_raw(ptr::with_exposed_provenance::<Box<dyn FnOnce()>>(main).cast_mut())();

5150
5251

// run all destructors

53-

run_dtors();

52+

crate::sys::thread_local::destructors::run();

5453

}

5554

}

5655

}

Original file line numberDiff line numberDiff line change

@@ -14,7 +14,6 @@ use crate::{

1414

num::NonZero,

1515

ptr::NonNull,

1616

sync::atomic::{AtomicUsize, Ordering},

17-

sys::thread_local_dtor::run_dtors,

1817

time::Duration,

1918

};

2019

@@ -116,7 +115,7 @@ impl Thread {

116115
117116

// Run TLS destructors now because they are not

118117

// called automatically for terminated tasks.

119-

unsafe { run_dtors() };

118+

unsafe { crate::sys::thread_local::destructors::run() };

120119
121120

let old_lifecycle = inner

122121

.lifecycle

Original file line numberDiff line numberDiff line change

@@ -26,7 +26,6 @@ pub mod pipe;

2626

pub mod process;

2727

pub mod stdio;

2828

pub mod thread;

29-

pub mod thread_local_key;

3029

pub mod thread_parking;

3130

pub mod time;

3231

pub mod waitqueue;

Original file line numberDiff line numberDiff line change

@@ -33,8 +33,6 @@ pub mod pipe;

3333

pub mod process;

3434

pub mod stdio;

3535

pub use self::itron::thread;

36-

pub mod thread_local_dtor;

37-

pub mod thread_local_key;

3836

pub use self::itron::thread_parking;

3937

pub mod time;

4038
Original file line numberDiff line numberDiff line change

@@ -27,9 +27,6 @@ pub mod process;

2727

mod rand;

2828

pub mod stdio;

2929

pub mod thread;

30-

pub mod thread_local_dtor;

31-

#[path = "../unix/thread_local_key.rs"]

32-

pub mod thread_local_key;

3330

#[allow(non_upper_case_globals)]

3431

#[path = "../unix/time.rs"]

3532

pub mod time;