diff options
author | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-09 15:30:48 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:51:35 +0300 |
commit | fe7f427c00220bb83fbb2ecad7e5a8a7969b682b (patch) | |
tree | 404b8c36bbc48cd863dfd84e7290af6885de330b /base | |
parent | 30de68c9dc414643959d3516b3e85b867e6e0068 (diff) |
Review fix
Diffstat (limited to 'base')
-rw-r--r-- | base/deferred_task.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/base/deferred_task.cpp b/base/deferred_task.cpp index a3755dbab4..ccb9edd322 100644 --- a/base/deferred_task.cpp +++ b/base/deferred_task.cpp @@ -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(); } }); } |