This is an automated email from the ASF dual-hosted git repository. pengzheng pushed a commit to branch hotfix/framework_shutdown_deadlock in repository https://gitbox.apache.org/repos/asf/celix.git
commit aa986852f08576dd84bd2db650a2f714a5058ead Author: PengZheng <[email protected]> AuthorDate: Thu Mar 17 12:49:45 2022 +0800 Fix a first-check-then-do race condition during framework shutdown. --- libs/framework/src/framework.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c index 8bf58ac..c2ec40b 100644 --- a/libs/framework/src/framework.c +++ b/libs/framework/src/framework.c @@ -1591,7 +1591,7 @@ static inline bool fw_removeTopEventFromQueue(celix_framework_t* fw) { static inline void fw_handleEvents(celix_framework_t* framework) { celixThreadMutex_lock(&framework->dispatcher.mutex); int size = framework->dispatcher.eventQueueSize + celix_arrayList_size(framework->dispatcher.dynamicEventQueue); - if (size == 0) { + if (size == 0 && framework->dispatcher.active) { celixThreadCondition_timedwaitRelative(&framework->dispatcher.cond, &framework->dispatcher.mutex, 1, 0); } size = framework->dispatcher.eventQueueSize + celix_arrayList_size(framework->dispatcher.dynamicEventQueue);
