Change lock type
authorKrystian Kuzniarek <krystian.kuzniarek@gmail.com>
Thu, 31 Dec 2020 16:00:39 +0000 (17:00 +0100)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sat, 30 Jan 2021 11:57:27 +0000 (12:57 +0100)
No additional features of std::unique_lock has been previously used
so it's better to use a lighter lock.

closes https://github.com/official-stockfish/Stockfish/pull/3284

No functional change.

AUTHORS
src/syzygy/tbprobe.cpp

diff --git a/AUTHORS b/AUTHORS
index f3ae5f090244da8e1faf2013394d30ffc1578dfd..d2b26469ea59a8bc23c9c1b6fd95402a33737dca 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -100,6 +100,7 @@ Ken Takusagawa
 kinderchocolate
 Kiran Panditrao (Krgp)
 Kojirion
+Krystian Kuzniarek (kuzkry)
 Leonardo Ljubičić (ICCF World Champion)
 Leonid Pechenik (lp--)
 Linus Arver (listx)
index 97d848a22af4bf3e72079995c401e656bc1ac5da..36234786f126dd004b8cdc8b16f1f5a72246f9da 100644 (file)
@@ -1141,7 +1141,7 @@ void* mapped(TBTable<Type>& e, const Position& pos) {
     if (e.ready.load(std::memory_order_acquire))
         return e.baseAddress; // Could be nullptr if file does not exist
 
-    std::unique_lock<std::mutex> lk(mutex);
+    std::scoped_lock<std::mutex> lk(mutex);
 
     if (e.ready.load(std::memory_order_relaxed)) // Recheck under lock
         return e.baseAddress;