Review fix

This commit is contained in:
Sergey Yershov 2016-03-09 15:30:48 +03:00
parent 30de68c9dc
commit fe7f427c00

View file

@ -15,18 +15,15 @@ DeferredTask::DeferredTask(TDuration const & duration) : m_duration(duration)
continue;
}
if (m_cv.wait_for(l, m_duration) != cv_status::timeout)
if (m_cv.wait_for(l, m_duration) != cv_status::timeout || !m_fn)
continue;
auto fn = move(m_fn);
m_fn = nullptr;
if (fn)
{
l.unlock();
fn();
l.lock();
}
l.unlock();
fn();
l.lock();
}
});
}