Use WordLock instead of std::mutex for Threading
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2018 17:30:26 +0000 (17:30 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2018 17:30:26 +0000 (17:30 +0000)
commit5a46d14f0fa7ab7408269bd14fea1735a05b50e4
treeee38f4bdc31ac4bafd370ffca90781ef80ea6c9d
parent6ef93d4fcd345bb2e3612df1b6d3933428b95eda
Use WordLock instead of std::mutex for Threading
https://bugs.webkit.org/show_bug.cgi?id=185121

Reviewed by Geoffrey Garen.

Source/bmalloc:

Add constexpr to explicitly describe that bmalloc::Mutex constructor is constexpr.

* bmalloc/Mutex.h:

Source/JavaScriptCore:

ThreadGroup starts using WordLock.

* heap/MachineStackMarker.h:
(JSC::MachineThreads::getLock):

Source/WTF:

Before r231151, WordLock depends on ThreadSpecific. It means that our Threading implementation
cannot use this lock since Threading primitives could touch these locks after ThreadSpecific
for that WordLock is destroyed.

Now WordLock is changed not to use ThreadSpecific. So it does not depend on our Threading
mechanism and our Threading can start using WordLock internally.

This patch changes WTF::Thread and WTF::ThreadGroup to use WordLock instead of std::mutex.

And add constexpr to explicitly describe that Lock, Condition, and WordLock constructors are constexpr.

* wtf/Condition.h:
* wtf/Lock.h:
* wtf/ThreadGroup.h:
(WTF::ThreadGroup::getLock):
* wtf/Threading.cpp:
(WTF::Thread::didExit):
(WTF::Thread::addToThreadGroup):
(WTF::Thread::removeFromThreadGroup):
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::signal):
(WTF::Thread::establishPlatformSpecificHandle):
* wtf/ThreadingWin.cpp:
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::establishPlatformSpecificHandle):
(WTF::Thread::initializeTLSKey):
(WTF::Thread::currentDying):
(WTF::Thread::get):
(WTF::Thread::initializeTLS):
(WTF::Thread::destructTLS):
(WTF::threadMapMutex): Deleted.
* wtf/WordLock.h:

Tools:

* TestWebKitAPI/Tests/WTF/Signals.cpp:
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231158 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/MachineStackMarker.h
Source/WTF/ChangeLog
Source/WTF/wtf/Condition.h
Source/WTF/wtf/Lock.h
Source/WTF/wtf/ThreadGroup.h
Source/WTF/wtf/Threading.cpp
Source/WTF/wtf/Threading.h
Source/WTF/wtf/ThreadingPthreads.cpp
Source/WTF/wtf/ThreadingWin.cpp
Source/WTF/wtf/WordLock.h
Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc/Mutex.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/Signals.cpp