mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-09 14:03:20 +09:00
1 parent
d5f4153422
commit
238769f5eb
1 file changed
+12
-8
+12
-8
@@ -162,19 +162,23 @@ protected:
|
||||
{
|
||||
end = false;
|
||||
|
||||
std::unique_lock<std::mutex> ul(lock);
|
||||
|
||||
while (true)
|
||||
{
|
||||
cond.wait(ul, [&]{return (end || !pending.empty());});
|
||||
std::function<void()> fn;
|
||||
|
||||
if (end)
|
||||
{
|
||||
break;
|
||||
}
|
||||
std::unique_lock<std::mutex> ul(lock);
|
||||
|
||||
auto fn = pending.front();
|
||||
pending.pop();
|
||||
cond.wait(ul, [&]{return (end || !pending.empty());});
|
||||
|
||||
if (end)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
fn = pending.front();
|
||||
pending.pop();
|
||||
}
|
||||
|
||||
fn();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user