You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pe...@apache.org on 2023/09/19 05:24:11 UTC
[celix] 01/01: Remove a check-then-act race condition.
This is an automated email from the ASF dual-hosted git repository.
pengzheng pushed a commit to branch hotfix/minor-race-condition
in repository https://gitbox.apache.org/repos/asf/celix.git
commit beb910ee8f413f9e1fa2b3b132bc4a5c83f5ae4c
Author: PengZheng <ho...@gmail.com>
AuthorDate: Tue Sep 19 13:23:56 2023 +0800
Remove a check-then-act race condition.
---
libs/framework/src/dm_dependency_manager_impl.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/libs/framework/src/dm_dependency_manager_impl.c b/libs/framework/src/dm_dependency_manager_impl.c
index 2b5aee9a..7208cf2f 100644
--- a/libs/framework/src/dm_dependency_manager_impl.c
+++ b/libs/framework/src/dm_dependency_manager_impl.c
@@ -260,10 +260,6 @@ celix_array_list_t * celix_dependencyManager_createInfos(celix_dependency_manage
static void celix_dm_allComponentsActiveCallback(void *handle, const celix_bundle_t *bnd) {
bool *allActivePtr = handle;
- if (celix_bundle_getState(bnd) != CELIX_BUNDLE_STATE_ACTIVE) {
- return;
- }
-
celix_bundle_context_t *context = NULL;
bundle_getContext((celix_bundle_t*)bnd, &context);
celix_dependency_manager_t *mng = celix_bundleContext_getDependencyManager(context);
@@ -274,9 +270,10 @@ static void celix_dm_allComponentsActiveCallback(void *handle, const celix_bundl
}
bool celix_dependencyManager_allComponentsActive(celix_dependency_manager_t *manager) {
- bool allActive = true;
- celix_bundleContext_useBundles(manager->ctx, &allActive, celix_dm_allComponentsActiveCallback);
- return allActive;
+ bool allActive = true;
+ celix_framework_t* fw = celix_bundleContext_getFramework(manager->ctx);
+ celix_framework_useActiveBundles(fw, true, &allActive, celix_dm_allComponentsActiveCallback);
+ return allActive;
}
size_t celix_dependencyManager_nrOfComponents(celix_dependency_manager_t *mng) {