Skip to content

Commit

Permalink
Merge pull request #402 from apache/hotfix/framework_shutdown_deadlock
Browse files Browse the repository at this point in the history
Fix a first-check-then-do race condition during framework shutdown.
  • Loading branch information
PengZheng committed Mar 18, 2022
2 parents 3b651da + aa98685 commit c83bc07
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/framework/src/framework.c
Expand Up @@ -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);
Expand Down

0 comments on commit c83bc07

Please sign in to comment.