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..c74c023cc5056f3e9b7cae98988afcb80d7bd4cf 100644 |
--- a/runtime/vm/os_thread_win.cc |
+++ b/runtime/vm/os_thread_win.cc |
@@ -14,6 +14,9 @@ |
namespace dart { |
+// This flag is flipped by platform_win.cc when the process is exiting. |
zra
2015/11/03 22:55:12
Please add a TODO for me to try removing when shut
Cutch
2015/11/03 23:02:24
Done.
|
+bool private_flag_windows_run_tls_destructors = true; |
+ |
class ThreadStartData { |
public: |
ThreadStartData(OSThread::ThreadStartFunction function, uword parameter) |
@@ -634,6 +637,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) { |