mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-25 02:50:08 +03:00
parent
d5f4153422
commit
238769f5eb
@ -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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user