summaryrefslogtreecommitdiff
path: root/Source/WTF/wtf/HashTable.cpp
diff options
context:
space:
mode:
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());