use scoped lock

pull/19/head
Andrew Cassidy 2 years ago
parent 920059bea1
commit 661536e6f6

@ -58,7 +58,7 @@ template <size_t N> class OrderTable {
static bool Generate() { static bool Generate() {
static_assert(N == 4 || N == 3); static_assert(N == 4 || N == 3);
table_mutex.lock(); std::scoped_lock{table_mutex};
if (!generated) { if (!generated) {
hashes = new std::array<Hash, HashCount>(); hashes = new std::array<Hash, HashCount>();
factors = new std::array<Vector4, OrderCount>(); factors = new std::array<Vector4, OrderCount>();
@ -85,8 +85,6 @@ template <size_t N> class OrderTable {
generated = true; generated = true;
} }
table_mutex.unlock();
assert(generated); assert(generated);
return true; return true;
} }

Loading…
Cancel
Save