Title: [187177] trunk/Source/WTF
Revision
187177
Author
fpi...@apple.com
Date
2015-07-22 13:49:20 -0700 (Wed, 22 Jul 2015)

Log Message

Introduce release assert for using threads before threading is initialized
https://bugs.webkit.org/show_bug.cgi?id=147200

Reviewed by Michael Saboff.
        
This will help bugs where you use createThread() before calling initializeThreading().

* wtf/ThreadIdentifierDataPthreads.cpp:
(WTF::ThreadIdentifierData::initialize):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (187176 => 187177)


--- trunk/Source/WTF/ChangeLog	2015-07-22 20:36:53 UTC (rev 187176)
+++ trunk/Source/WTF/ChangeLog	2015-07-22 20:49:20 UTC (rev 187177)
@@ -1,3 +1,15 @@
+2015-07-22  Filip Pizlo  <fpi...@apple.com>
+
+        Introduce release assert for using threads before threading is initialized
+        https://bugs.webkit.org/show_bug.cgi?id=147200
+
+        Reviewed by Michael Saboff.
+        
+        This will help bugs where you use createThread() before calling initializeThreading().
+
+        * wtf/ThreadIdentifierDataPthreads.cpp:
+        (WTF::ThreadIdentifierData::initialize):
+
 2015-07-21  Daniel Bates  <daba...@apple.com>
 
         WTFCrash() in WebKit::WebProcess::networkConnection()

Modified: trunk/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp (187176 => 187177)


--- trunk/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp	2015-07-22 20:36:53 UTC (rev 187176)
+++ trunk/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp	2015-07-22 20:49:20 UTC (rev 187177)
@@ -71,6 +71,10 @@
 void ThreadIdentifierData::initialize(ThreadIdentifier id)
 {
     ASSERT(!identifier());
+    // Ideally we'd have this as a release assert everywhere, but that would hurt performane.
+    // Having this release assert here means that we will catch "didn't call
+    // WTF::initializeThreading() soon enough" bugs in release mode.
+    RELEASE_ASSERT(m_key != PTHREAD_KEYS_MAX);
     pthread_setspecific(m_key, new ThreadIdentifierData(id));
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to