summaryrefslogtreecommitdiff
path: root/Source/WTF/wtf/HashTable.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WTF/wtf/HashTable.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WTF/wtf/HashTable.cpp')
-rw-r--r--Source/WTF/wtf/HashTable.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/Source/WTF/wtf/HashTable.cpp b/Source/WTF/wtf/HashTable.cpp
index 458dd531f..b06eaf6c2 100644
--- a/Source/WTF/wtf/HashTable.cpp
+++ b/Source/WTF/wtf/HashTable.cpp
@@ -36,20 +36,11 @@ unsigned HashTableStats::numCollisions;
unsigned HashTableStats::collisionGraph[4096];
unsigned HashTableStats::maxCollisions;
-static std::mutex& hashTableStatsMutex()
-{
- static std::once_flag onceFlag;
- static std::mutex* mutex;
- std::call_once(onceFlag, []{
- mutex = std::make_unique<std::mutex>().release();
- });
-
- return *mutex;
-}
+static StaticLock hashTableStatsMutex;
void HashTableStats::recordCollisionAtCount(unsigned count)
{
- std::lock_guard<std::mutex> lock(hashTableStatsMutex());
+ std::lock_guard<StaticLock> lock(hashTableStatsMutex);
if (count > maxCollisions)
maxCollisions = count;
@@ -59,7 +50,7 @@ void HashTableStats::recordCollisionAtCount(unsigned count)
void HashTableStats::dumpStats()
{
- std::lock_guard<std::mutex> lock(hashTableStatsMutex());
+ std::lock_guard<StaticLock> lock(hashTableStatsMutex);
dataLogF("\nWTF::HashTable statistics\n\n");
dataLogF("%u accesses\n", numAccesses.load());