mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Change lock type
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.
This commit is contained in:
parent
77eeea407c
commit
329ef2a6aa
2 changed files with 2 additions and 1 deletions
1
AUTHORS
1
AUTHORS
|
@ -100,6 +100,7 @@ Ken Takusagawa
|
||||||
kinderchocolate
|
kinderchocolate
|
||||||
Kiran Panditrao (Krgp)
|
Kiran Panditrao (Krgp)
|
||||||
Kojirion
|
Kojirion
|
||||||
|
Krystian Kuzniarek (kuzkry)
|
||||||
Leonardo Ljubičić (ICCF World Champion)
|
Leonardo Ljubičić (ICCF World Champion)
|
||||||
Leonid Pechenik (lp--)
|
Leonid Pechenik (lp--)
|
||||||
Linus Arver (listx)
|
Linus Arver (listx)
|
||||||
|
|
|
@ -1141,7 +1141,7 @@ void* mapped(TBTable<Type>& e, const Position& pos) {
|
||||||
if (e.ready.load(std::memory_order_acquire))
|
if (e.ready.load(std::memory_order_acquire))
|
||||||
return e.baseAddress; // Could be nullptr if file does not exist
|
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
|
if (e.ready.load(std::memory_order_relaxed)) // Recheck under lock
|
||||||
return e.baseAddress;
|
return e.baseAddress;
|
||||||
|
|
Loading…
Add table
Reference in a new issue