Unique_lock can be released instead of required a scope closure.
This commit is contained in:
parent
c8245e83d9
commit
a9bc2786cc
1 changed files with 6 additions and 7 deletions
|
@ -3000,15 +3000,14 @@ void rai::active_transactions::announce_loop ()
|
|||
|
||||
void rai::active_transactions::stop ()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock (mutex);
|
||||
while (!started)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock (mutex);
|
||||
while (!started)
|
||||
{
|
||||
condition.wait (lock);
|
||||
}
|
||||
stopped = true;
|
||||
condition.notify_all ();
|
||||
condition.wait (lock);
|
||||
}
|
||||
stopped = true;
|
||||
condition.notify_all ();
|
||||
lock.unlock ();
|
||||
if (thread.joinable ())
|
||||
{
|
||||
thread.join ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue