Skip to content

Commit

Permalink
gh-215: Remove all remaining scheduled events for an inactive dispatc…
Browse files Browse the repository at this point in the history
…her.
  • Loading branch information
PengZheng committed Jun 12, 2024
1 parent b5214cf commit e07b2e8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libs/framework/src/framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ static void celix_framework_processScheduledEvents(celix_framework_t* fw) {
celixThreadMutex_lock(&fw->dispatcher.mutex);
CELIX_LONG_HASH_MAP_ITERATE(fw->dispatcher.scheduledEvents, entry) {
celix_scheduled_event_t* visit = entry.value.ptrValue;
if (celix_scheduledEvent_isMarkedForRemoval(visit)) {
if (!fw->dispatcher.active || celix_scheduledEvent_isMarkedForRemoval(visit)) {
removeEvent = visit;
celix_longHashMap_remove(fw->dispatcher.scheduledEvents, celix_scheduledEvent_getId(visit));
break;
Expand Down Expand Up @@ -1536,6 +1536,7 @@ static void *fw_eventDispatcher(void *fw) {
celixThreadMutex_unlock(&framework->dispatcher.mutex);
while (needExtraRun) {
fw_handleEvents(framework);
celix_framework_processScheduledEvents(framework);
celixThreadMutex_lock(&framework->dispatcher.mutex);
needExtraRun = celix_framework_eventQueueSize(fw) > 0;
celixThreadMutex_unlock(&framework->dispatcher.mutex);
Expand Down

0 comments on commit e07b2e8

Please sign in to comment.