From be96dc2ddfa719da1f53669fae66f783779ac29a Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Fri, 23 May 2014 11:13:38 -0700 Subject: [PATCH] fix(library/module): bug in next_task method Signed-off-by: Leonardo de Moura --- src/library/module.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/library/module.cpp b/src/library/module.cpp index 78285f3805..3c09c62719 100644 --- a/src/library/module.cpp +++ b/src/library/module.cpp @@ -272,12 +272,12 @@ struct import_modules_fn { while (true) { check_interrupted(); unique_lock lk(m_asynch_mutex); - if (m_all_modules_imported) - return optional(); if (!m_asynch_tasks.empty()) { asynch_update_fn r = m_asynch_tasks.back(); m_asynch_tasks.pop_back(); return optional(r); + } else if (m_all_modules_imported) { + return optional(); } else { m_asynch_cv.wait(lk); }