Title: [91094] trunk/Source/_javascript_Core
- Revision
- 91094
- Author
- [email protected]
- Date
- 2011-07-15 12:46:47 -0700 (Fri, 15 Jul 2011)
Log Message
Unreviewed, rolling out r91082, r91087, and r91089.
http://trac.webkit.org/changeset/91082
http://trac.webkit.org/changeset/91087
http://trac.webkit.org/changeset/91089
https://bugs.webkit.org/show_bug.cgi?id=64616
gtk tests are failing a lot after this change. (Requested by
dave_levin on #webkit).
Patch by Sheriff Bot <[email protected]> on 2011-07-15
* wtf/ThreadIdentifierDataPthreads.cpp:
(WTF::ThreadIdentifierData::identifier):
(WTF::ThreadIdentifierData::initialize):
(WTF::ThreadIdentifierData::initializeKeyOnceHelper):
(WTF::ThreadIdentifierData::initializeKeyOnce):
* wtf/ThreadIdentifierDataPthreads.h:
* wtf/ThreadingPthreads.cpp:
(WTF::initializeThreading):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (91093 => 91094)
--- trunk/Source/_javascript_Core/ChangeLog 2011-07-15 19:44:23 UTC (rev 91093)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-07-15 19:46:47 UTC (rev 91094)
@@ -1,3 +1,23 @@
+2011-07-15 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r91082, r91087, and r91089.
+ http://trac.webkit.org/changeset/91082
+ http://trac.webkit.org/changeset/91087
+ http://trac.webkit.org/changeset/91089
+ https://bugs.webkit.org/show_bug.cgi?id=64616
+
+ gtk tests are failing a lot after this change. (Requested by
+ dave_levin on #webkit).
+
+ * wtf/ThreadIdentifierDataPthreads.cpp:
+ (WTF::ThreadIdentifierData::identifier):
+ (WTF::ThreadIdentifierData::initialize):
+ (WTF::ThreadIdentifierData::initializeKeyOnceHelper):
+ (WTF::ThreadIdentifierData::initializeKeyOnce):
+ * wtf/ThreadIdentifierDataPthreads.h:
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeThreading):
+
2011-07-15 David Levin <[email protected]>
Another attempted build fix.
Modified: trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.cpp (91093 => 91094)
--- trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.cpp 2011-07-15 19:44:23 UTC (rev 91093)
+++ trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.cpp 2011-07-15 19:46:47 UTC (rev 91094)
@@ -36,11 +36,10 @@
#include "Threading.h"
-#include <limits.h>
-
namespace WTF {
-pthread_key_t ThreadIdentifierData::m_key = PTHREAD_KEYS_MAX;
+pthread_key_t ThreadIdentifierData::m_key;
+static pthread_once_t _onceControl_ = PTHREAD_ONCE_INIT;
void clearPthreadHandleForIdentifier(ThreadIdentifier);
@@ -49,15 +48,9 @@
clearPthreadHandleForIdentifier(m_identifier);
}
-void ThreadIdentifierData::initializeOnce()
-{
- if (pthread_key_create(&m_key, destruct))
- CRASH();
-}
-
ThreadIdentifier ThreadIdentifierData::identifier()
{
- ASSERT(m_key != PTHREAD_KEYS_MAX);
+ initializeKeyOnce();
ThreadIdentifierData* threadIdentifierData = static_cast<ThreadIdentifierData*>(pthread_getspecific(m_key));
return threadIdentifierData ? threadIdentifierData->m_identifier : 0;
@@ -66,6 +59,8 @@
void ThreadIdentifierData::initialize(ThreadIdentifier id)
{
ASSERT(!identifier());
+
+ initializeKeyOnce();
pthread_setspecific(m_key, new ThreadIdentifierData(id));
}
@@ -84,6 +79,18 @@
pthread_setspecific(m_key, threadIdentifierData);
}
+void ThreadIdentifierData::initializeKeyOnceHelper()
+{
+ if (pthread_key_create(&m_key, destruct))
+ CRASH();
+}
+
+void ThreadIdentifierData::initializeKeyOnce()
+{
+ if (pthread_once(&onceControl, initializeKeyOnceHelper))
+ CRASH();
+}
+
} // namespace WTF
#endif // USE(PTHREADS)
Modified: trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.h (91093 => 91094)
--- trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.h 2011-07-15 19:44:23 UTC (rev 91093)
+++ trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.h 2011-07-15 19:46:47 UTC (rev 91094)
@@ -42,10 +42,6 @@
public:
~ThreadIdentifierData();
- // One time initialization for this class as a whole.
- // This method must be called before initialize() and it is not thread-safe.
- static void initializeOnce();
-
// Creates and puts an instance of ThreadIdentifierData into thread-specific storage.
static void initialize(ThreadIdentifier identifier);
@@ -66,6 +62,9 @@
// ThreadIdentifier from the threadMap, completing the cleanup.
static void destruct(void* data);
+ static void initializeKeyOnceHelper();
+ static void initializeKeyOnce();
+
ThreadIdentifier m_identifier;
bool m_isDestroyedOnce;
static pthread_key_t m_key;
Modified: trunk/Source/_javascript_Core/wtf/ThreadingPthreads.cpp (91093 => 91094)
--- trunk/Source/_javascript_Core/wtf/ThreadingPthreads.cpp 2011-07-15 19:44:23 UTC (rev 91093)
+++ trunk/Source/_javascript_Core/wtf/ThreadingPthreads.cpp 2011-07-15 19:46:47 UTC (rev 91094)
@@ -81,7 +81,6 @@
atomicallyInitializedStaticMutex = new Mutex;
threadMapMutex();
initializeRandomNumberGenerator();
- ThreadIdentifierData::initializeOnce();
}
void lockAtomicallyInitializedStaticMutex()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes