diff options
| author | bors <bors@rust-lang.org> | 2019-01-20 11:08:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-01-20 11:08:37 +0000 |
| commit | d38d6be336e87055d90375c981806d5d133f446a (patch) | |
| tree | 633c25a2d88501d0fe178f944055264d5a36d1c9 /src/libstd/thread | |
| parent | 2ab5d8ac447f1f3f865dbae5bafbdeacacdea6d9 (diff) | |
| parent | 1a51bb8174e97251a37fcd83ff8750b7773e762a (diff) | |
| download | rust-d38d6be336e87055d90375c981806d5d133f446a.tar.gz rust-d38d6be336e87055d90375c981806d5d133f446a.zip | |
Auto merge of #57655 - mtak-:fix-tls-dtors-macos, r=alexcrichton
OSX: fix #57534 registering thread dtors while running thread dtors r? @alexcrichton - "fast" `thread_local` destructors get run even on the main thread - "fast" `thread_local` dtors, can initialize other `thread_local`'s One corner case where this fix doesn't work, is when a C++ `thread_local` triggers the initialization of a rust `thread_local`. I did not add any std::thread specific flag to indicate that the thread is currently exiting, which would be checked before registering a new dtor (I didn't really know where to stick that). I think this does the trick tho! Let me know if anything needs tweaking/fixing/etc. resolves this for macos: https://github.com/rust-lang/rust/issues/28129 fixes: https://github.com/rust-lang/rust/issues/57534
Diffstat (limited to 'src/libstd/thread')
| -rw-r--r-- | src/libstd/thread/local.rs | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index efd231e0176..5d2eb5f8e73 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -69,9 +69,6 @@ use mem; /// destroyed, but not all platforms have this guard. Those platforms that do /// not guard typically have a synthetic limit after which point no more /// destructors are run. -/// 3. On macOS, initializing TLS during destruction of other TLS slots can -/// sometimes cancel *all* destructors for the current thread, whether or not -/// the slots have already had their destructors run or not. /// /// [`with`]: ../../std/thread/struct.LocalKey.html#method.with /// [`thread_local!`]: ../../std/macro.thread_local.html @@ -604,11 +601,8 @@ mod tests { } // Note that this test will deadlock if TLS destructors aren't run (this - // requires the destructor to be run to pass the test). macOS has a known bug - // where dtors-in-dtors may cancel other destructors, so we just ignore this - // test on macOS. + // requires the destructor to be run to pass the test). #[test] - #[cfg_attr(target_os = "macos", ignore)] fn dtors_in_dtors_in_dtors() { struct S1(Sender<()>); thread_local!(static K1: UnsafeCell<Option<S1>> = UnsafeCell::new(None)); |
