mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
Auto merge of #3550 - RalfJung:unix-tls, r=RalfJung
tls dtors: treat all unixes uniformly
This commit is contained in:
commit
82456b4ce3
@ -242,21 +242,21 @@ impl<'tcx> TlsDtorsState<'tcx> {
|
|||||||
match &mut self.0 {
|
match &mut self.0 {
|
||||||
Init => {
|
Init => {
|
||||||
match this.tcx.sess.target.os.as_ref() {
|
match this.tcx.sess.target.os.as_ref() {
|
||||||
"linux" | "freebsd" | "android" => {
|
|
||||||
// Run the pthread dtors.
|
|
||||||
break 'new_state PthreadDtors(Default::default());
|
|
||||||
}
|
|
||||||
"macos" => {
|
"macos" => {
|
||||||
// The macOS thread wide destructor runs "before any TLS slots get
|
// The macOS thread wide destructor runs "before any TLS slots get
|
||||||
// freed", so do that first.
|
// freed", so do that first.
|
||||||
this.schedule_macos_tls_dtor()?;
|
this.schedule_macos_tls_dtor()?;
|
||||||
// When the stack is empty again, go on with the pthread dtors.
|
// When that destructor is done, go on with the pthread dtors.
|
||||||
|
break 'new_state PthreadDtors(Default::default());
|
||||||
|
}
|
||||||
|
_ if this.target_os_is_unix() => {
|
||||||
|
// All other Unixes directly jump to running the pthread dtors.
|
||||||
break 'new_state PthreadDtors(Default::default());
|
break 'new_state PthreadDtors(Default::default());
|
||||||
}
|
}
|
||||||
"windows" => {
|
"windows" => {
|
||||||
// Determine which destructors to run.
|
// Determine which destructors to run.
|
||||||
let dtors = this.lookup_windows_tls_dtors()?;
|
let dtors = this.lookup_windows_tls_dtors()?;
|
||||||
// And move to the final state.
|
// And move to the next state, that runs them.
|
||||||
break 'new_state WindowsDtors(dtors);
|
break 'new_state WindowsDtors(dtors);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
Loading…
Reference in New Issue
Block a user