[Win] Use NeverDestroyed template.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2016 17:20:31 +0000 (17:20 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2016 17:20:31 +0000 (17:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157345

Reviewed by Darin Adler.

* wtf/ThreadingWin.cpp:
(WTF::threadMapMutex):
(WTF::threadMap):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200420 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/wtf/ThreadingWin.cpp

index 7aa6b47..893b7da 100644 (file)
@@ -1,3 +1,14 @@
+2016-05-04  Per Arne Vollan  <peavo@outlook.com>
+
+        [Win] Use NeverDestroyed template.
+        https://bugs.webkit.org/show_bug.cgi?id=157345
+
+        Reviewed by Darin Adler.
+
+        * wtf/ThreadingWin.cpp:
+        (WTF::threadMapMutex):
+        (WTF::threadMap):
+
 2016-05-04  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, rolling out r200383 and r200406.
index 7644024..068646d 100644 (file)
@@ -99,6 +99,7 @@
 #include <wtf/CurrentTime.h>
 #include <wtf/HashMap.h>
 #include <wtf/MathExtras.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/RandomNumberSeed.h>
 #include <wtf/WTFThreadData.h>
 
@@ -141,7 +142,7 @@ void initializeCurrentThreadInternal(const char* szThreadName)
 
 static Mutex& threadMapMutex()
 {
-    static Mutex mutex;
+    static NeverDestroyed<Mutex> mutex;
     return mutex;
 }
 
@@ -166,7 +167,7 @@ void initializeThreading()
 
 static HashMap<DWORD, HANDLE>& threadMap()
 {
-    static HashMap<DWORD, HANDLE> map;
+    static NeverDestroyed<HashMap<DWORD, HANDLE>> map;
     return map;
 }