diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-20 13:02:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-11 13:45:58 +0200 |
commit | 60929e90ffa6993c271cfac9e285b1cca5a9f2cc (patch) | |
tree | 2f0f284b8e43dbe3b16ce18cc746763167102df4 /Source/JavaScriptCore | |
parent | d6a599dbc9d824a462b2b206316e102bf8136446 (diff) | |
download | qtwebkit-60929e90ffa6993c271cfac9e285b1cca5a9f2cc.tar.gz |
[WIN] Remove dependency on pthread from MachineStackMarker
https://bugs.webkit.org/show_bug.cgi?id=68429
Patch by Patrick Gansterer <paroga@webkit.org> on 2012-06-13
Reviewed by NOBODY (OOPS!).
Implement pthread TLS functionality with native windows functions.
* heap/MachineStackMarker.cpp: Use the new functions instead of pthread directly.
* heap/MachineStackMarker.h:
* wtf/ThreadSpecific.h:
(WTF::ThreadSpecificKeyCreate): Added wrapper around pthread_key_create.
(WTF::ThreadSpecificKeyDelete): Added wrapper around pthread_key_delete.
(WTF::ThreadSpecificSet): Added wrapper around pthread_setspecific.
(WTF::ThreadSpecificGet): Added wrapper around pthread_getspecific.
* wtf/ThreadSpecificWin.cpp:
Diffstat (limited to 'Source/JavaScriptCore')
-rw-r--r-- | Source/JavaScriptCore/ChangeLog | 18 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/MachineStackMarker.cpp | 14 | ||||
-rw-r--r-- | Source/JavaScriptCore/heap/MachineStackMarker.h | 4 |
3 files changed, 25 insertions, 11 deletions
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index a1cbefa36..f0e93b012 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,21 @@ +2012-06-13 Patrick Gansterer <paroga@webkit.org> + + [WIN] Remove dependency on pthread from MachineStackMarker + https://bugs.webkit.org/show_bug.cgi?id=68429 + + Reviewed by NOBODY (OOPS!). + + Implement pthread TLS functionality with native windows functions. + + * heap/MachineStackMarker.cpp: Use the new functions instead of pthread directly. + * heap/MachineStackMarker.h: + * wtf/ThreadSpecific.h: + (WTF::ThreadSpecificKeyCreate): Added wrapper around pthread_key_create. + (WTF::ThreadSpecificKeyDelete): Added wrapper around pthread_key_delete. + (WTF::ThreadSpecificSet): Added wrapper around pthread_setspecific. + (WTF::ThreadSpecificGet): Added wrapper around pthread_getspecific. + * wtf/ThreadSpecificWin.cpp: + 2012-07-10 Filip Pizlo <fpizlo@apple.com> REGRESSION(r122166): It made 170 tests crash on 32 bit platforms diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.cpp b/Source/JavaScriptCore/heap/MachineStackMarker.cpp index 7eb57479b..8e0c57b6a 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.cpp +++ b/Source/JavaScriptCore/heap/MachineStackMarker.cpp @@ -141,10 +141,8 @@ MachineThreads::MachineThreads(Heap* heap) MachineThreads::~MachineThreads() { - if (m_threadSpecific) { - int error = pthread_key_delete(m_threadSpecific); - ASSERT_UNUSED(error, !error); - } + if (m_threadSpecific) + ThreadSpecificKeyDelete(m_threadSpecific); MutexLocker registeredThreadsLock(m_registeredThreadsMutex); for (Thread* t = m_registeredThreads; t;) { @@ -181,19 +179,17 @@ void MachineThreads::makeUsableFromMultipleThreads() if (m_threadSpecific) return; - int error = pthread_key_create(&m_threadSpecific, removeThread); - if (error) - CRASH(); + ThreadSpecificKeyCreate(&m_threadSpecific, removeThread); } void MachineThreads::addCurrentThread() { ASSERT(!m_heap->globalData()->exclusiveThread || m_heap->globalData()->exclusiveThread == currentThread()); - if (!m_threadSpecific || pthread_getspecific(m_threadSpecific)) + if (!m_threadSpecific || ThreadSpecificGet(m_threadSpecific)) return; - pthread_setspecific(m_threadSpecific, this); + ThreadSpecificSet(m_threadSpecific, this); Thread* thread = new Thread(getCurrentPlatformThread(), wtfThreadData().stack().origin()); MutexLocker lock(m_registeredThreadsMutex); diff --git a/Source/JavaScriptCore/heap/MachineStackMarker.h b/Source/JavaScriptCore/heap/MachineStackMarker.h index 5c7705fcf..3d4aa22d4 100644 --- a/Source/JavaScriptCore/heap/MachineStackMarker.h +++ b/Source/JavaScriptCore/heap/MachineStackMarker.h @@ -22,8 +22,8 @@ #ifndef MachineThreads_h #define MachineThreads_h -#include <pthread.h> #include <wtf/Noncopyable.h> +#include <wtf/ThreadSpecific.h> #include <wtf/ThreadingPrimitives.h> namespace JSC { @@ -55,7 +55,7 @@ namespace JSC { Heap* m_heap; Mutex m_registeredThreadsMutex; Thread* m_registeredThreads; - pthread_key_t m_threadSpecific; + WTF::ThreadSpecificKey m_threadSpecific; }; } // namespace JSC |