std: refactor the TLS implementation · model-checking/verify-rust-std@b40c54b (original) (raw)
49 files changed
lines changed
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -33,9 +33,6 @@ pub mod pipe; | ||
| 33 | 33 | pub mod process; |
| 34 | 34 | pub mod stdio; |
| 35 | 35 | pub mod thread; |
| 36 | -pub mod thread_local_dtor; | |
| 37 | -#[path = "../unsupported/thread_local_key.rs"] | |
| 38 | -pub mod thread_local_key; | |
| 39 | 36 | pub mod time; |
| 40 | 37 | |
| 41 | 38 | use crate::io::ErrorKind; |
| @@ -98,7 +95,6 @@ pub unsafe extern "C" fn runtime_entry( | ||
| 98 | 95 | argv: *const *const c_char, |
| 99 | 96 | env: *const *const c_char, |
| 100 | 97 | ) -> ! { |
| 101 | -use thread_local_dtor::run_dtors; | |
| 102 | 98 | extern "C" { |
| 103 | 99 | fn main(argc: isize, argv: *const *const c_char) -> i32; |
| 104 | 100 | } |
| @@ -108,7 +104,7 @@ pub unsafe extern "C" fn runtime_entry( | ||
| 108 | 104 | |
| 109 | 105 | let result = main(argc as isize, argv); |
| 110 | 106 | |
| 111 | -run_dtors(); | |
| 107 | +crate::sys::thread_local::destructors::run(); | |
| 112 | 108 | hermit_abi::exit(result); |
| 113 | 109 | } |
| 114 | 110 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| 1 | 1 | #![allow(dead_code)] |
| 2 | 2 | |
| 3 | 3 | use super::hermit_abi; |
| 4 | -use super::thread_local_dtor::run_dtors; | |
| 5 | 4 | use crate::ffi::CStr; |
| 6 | 5 | use crate::io; |
| 7 | 6 | use crate::mem; |
| @@ -50,7 +49,7 @@ impl Thread { | ||
| 50 | 49 | Box::from_raw(ptr::with_exposed_provenance::<Box<dyn FnOnce()>>(main).cast_mut())(); |
| 51 | 50 | |
| 52 | 51 | // run all destructors |
| 53 | -run_dtors(); | |
| 52 | +crate::sys::thread_local::destructors::run(); | |
| 54 | 53 | } |
| 55 | 54 | } |
| 56 | 55 | } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -14,7 +14,6 @@ use crate::{ | ||
| 14 | 14 | num::NonZero, |
| 15 | 15 | ptr::NonNull, |
| 16 | 16 | sync::atomic::{AtomicUsize, Ordering}, |
| 17 | - sys::thread_local_dtor::run_dtors, | |
| 18 | 17 | time::Duration, |
| 19 | 18 | }; |
| 20 | 19 | |
| @@ -116,7 +115,7 @@ impl Thread { | ||
| 116 | 115 | |
| 117 | 116 | // Run TLS destructors now because they are not |
| 118 | 117 | // called automatically for terminated tasks. |
| 119 | -unsafe { run_dtors() }; | |
| 118 | +unsafe { crate::sys::thread_local::destructors::run() }; | |
| 120 | 119 | |
| 121 | 120 | let old_lifecycle = inner |
| 122 | 121 | .lifecycle |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -26,7 +26,6 @@ pub mod pipe; | ||
| 26 | 26 | pub mod process; |
| 27 | 27 | pub mod stdio; |
| 28 | 28 | pub mod thread; |
| 29 | -pub mod thread_local_key; | |
| 30 | 29 | pub mod thread_parking; |
| 31 | 30 | pub mod time; |
| 32 | 31 | pub mod waitqueue; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -33,8 +33,6 @@ pub mod pipe; | ||
| 33 | 33 | pub mod process; |
| 34 | 34 | pub mod stdio; |
| 35 | 35 | pub use self::itron::thread; |
| 36 | -pub mod thread_local_dtor; | |
| 37 | -pub mod thread_local_key; | |
| 38 | 36 | pub use self::itron::thread_parking; |
| 39 | 37 | pub mod time; |
| 40 | 38 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -27,9 +27,6 @@ pub mod process; | ||
| 27 | 27 | mod rand; |
| 28 | 28 | pub mod stdio; |
| 29 | 29 | pub mod thread; |
| 30 | -pub mod thread_local_dtor; | |
| 31 | -#[path = "../unix/thread_local_key.rs"] | |
| 32 | -pub mod thread_local_key; | |
| 33 | 30 | #[allow(non_upper_case_globals)] |
| 34 | 31 | #[path = "../unix/time.rs"] |
| 35 | 32 | pub mod time; |