chore(fortuna): std::mutex -> std::unique_lock
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a3009709cf
commit
6e62e47d7b
@ -42,7 +42,7 @@ auto Fortuna::random_data(unsigned int n_bytes) -> void {
|
|||||||
std::string s;
|
std::string s;
|
||||||
// synchronise reads and writes to the between
|
// synchronise reads and writes to the between
|
||||||
// {generator,accumulator,fortuna} service threads
|
// {generator,accumulator,fortuna} service threads
|
||||||
std::lock_guard<std::mutex> lg(mtx);
|
std::unique_lock<std::mutex> uq_lock(mtx);
|
||||||
const int pools_to_use{ffsll(static_cast<int>(get_reseed_ctr()))};
|
const int pools_to_use{ffsll(static_cast<int>(get_reseed_ctr()))};
|
||||||
|
|
||||||
if (R.pools[0].get_s_length() >= min_pool_size && elapsed > R.Gen.reseed_interval) {
|
if (R.pools[0].get_s_length() >= min_pool_size && elapsed > R.Gen.reseed_interval) {
|
||||||
@ -71,6 +71,7 @@ auto Fortuna::random_data(unsigned int n_bytes) -> void {
|
|||||||
n_bytes, n);
|
n_bytes, n);
|
||||||
n.clear();
|
n.clear();
|
||||||
}
|
}
|
||||||
|
uq_lock.unlock();
|
||||||
|
|
||||||
const auto end{std::chrono::system_clock::now()};
|
const auto end{std::chrono::system_clock::now()};
|
||||||
std::chrono::duration<float> diff = end-start;
|
std::chrono::duration<float> diff = end-start;
|
||||||
|
Reference in New Issue
Block a user