Commit dce19dea authored by Peter Bell's avatar Peter Bell

Hold lock in latch::count_down to avoid cv destruction before notify

parent 3eb10bb4
...@@ -744,12 +744,10 @@ class latch ...@@ -744,12 +744,10 @@ class latch
latch(size_t n): num_left_(n) {} latch(size_t n): num_left_(n) {}
void count_down() void count_down()
{
{ {
lock_t lock(mut_); lock_t lock(mut_);
if (--num_left_) if (--num_left_)
return; return;
}
completed_.notify_all(); completed_.notify_all();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment