summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-20 13:02:56 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-25 13:36:27 +0200
commitc3974482a84bb8477175a82e37df0f9998242497 (patch)
tree7303929c0721e133c9241a266f28296c5d7886d5 /Source/JavaScriptCore
parent79ad030d505ccf79cf10aa9f8189ca3e2f61f6f4 (diff)
downloadqtwebkit-c3974482a84bb8477175a82e37df0f9998242497.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/ChangeLog18
-rw-r--r--Source/JavaScriptCore/heap/MachineStackMarker.cpp14
-rw-r--r--Source/JavaScriptCore/heap/MachineStackMarker.h4
3 files changed, 25 insertions, 11 deletions
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 20df558bb..153f7fd1d 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-06-23 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r121058.
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 0f5a4c3aa..2209f97e9 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