From 902b6160fa7ee13ba145530b065c90af1886a151 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Fri, 23 May 2014 14:43:03 -0700 Subject: [PATCH] fix(kernel/module): deadlock Signed-off-by: Leonardo de Moura --- src/library/module.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/library/module.cpp b/src/library/module.cpp index 1abfb91ae..6505a9e24 100644 --- a/src/library/module.cpp +++ b/src/library/module.cpp @@ -261,8 +261,10 @@ struct import_modules_fn { obj_counter++; } } - if (atomic_fetch_sub_explicit(&m_import_counter, 1u, memory_order_relaxed) == 1u) + if (atomic_fetch_sub_explicit(&m_import_counter, 1u, memory_order_relaxed) == 1u) { m_all_modules_imported = true; + m_asynch_cv.notify_all(); + } // Module was successfully imported, we should notify descendents. for (module_info_ptr const & d : r->m_dependents) { if (atomic_fetch_sub_explicit(&(d->m_counter), 1u, memory_order_relaxed) == 1u) {