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); }