Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: runtime/vm/os_thread_win.cc

Issue 1409723007: Hack around TLS destructors firing after the process exits round 2 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/os_thread_win.cc
diff --git a/runtime/vm/os_thread_win.cc b/runtime/vm/os_thread_win.cc
index 81cd216c992c9fdbc80e146e0e5054d621e620cf..fd8de38685fb401c88f85457d9994ed19673c1d9 100644
--- a/runtime/vm/os_thread_win.cc
+++ b/runtime/vm/os_thread_win.cc
@@ -14,6 +14,10 @@
namespace dart {
+// This flag is flipped by platform_win.cc when the process is exiting.
+// TODO(zra): Remove once VM shuts down cleanly.
+bool private_flag_windows_run_tls_destructors = true;
+
class ThreadStartData {
public:
ThreadStartData(OSThread::ThreadStartFunction function, uword parameter)
@@ -634,6 +638,9 @@ void ThreadLocalData::Shutdown() {
// Static callback function to call with each thread termination.
void NTAPI OnDartThreadExit(PVOID module, DWORD reason, PVOID reserved) {
+ if (!dart::private_flag_windows_run_tls_destructors) {
+ return;
+ }
// On XP SP0 & SP1, the DLL_PROCESS_ATTACH is never seen. It is sent on SP2+
// and on W2K and W2K3. So don't assume it is sent.
if (DLL_THREAD_DETACH == reason || DLL_PROCESS_DETACH == reason) {

Powered by Google App Engine
This is Rietveld 408576698