This is an automated email from the ASF dual-hosted git repository. pengzheng pushed a commit to branch feature/522-support-uncompressed-bundle in repository https://gitbox.apache.org/repos/asf/celix.git
commit 35db439447ad863caf2f1ce80a60b6deb6acb509 Author: PengZheng <[email protected]> AuthorDate: Sun Jun 25 16:25:07 2023 +0800 Remove unnecessary synchronizations for async bundle operations. --- libs/framework/src/framework.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c index 0a2d1dc6..d86a7e93 100644 --- a/libs/framework/src/framework.c +++ b/libs/framework/src/framework.c @@ -1880,8 +1880,9 @@ static long celix_framework_installAndStartBundleInternal(celix_framework_t *fw, } } } - - celix_framework_waitForBundleEvents(fw, bundleId); + if (!forcedAsync) { + celix_framework_waitForBundleEvents(fw, bundleId); + } framework_logIfError(fw->logger, status, NULL, "Failed to install bundle '%s'", bundleLoc); return bundleId; @@ -1900,7 +1901,9 @@ static bool celix_framework_uninstallBundleInternal(celix_framework_t *fw, long celix_framework_bundle_entry_t *bndEntry = celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(fw, bndId); if (bndEntry != NULL) { celix_status_t status = celix_framework_uninstallBundleOnANonCelixEventThread(fw, bndEntry, forcedAsync, permanent); - celix_framework_waitForBundleEvents(fw, bndId); + if (!forcedAsync) { + celix_framework_waitForBundleEvents(fw, bndId); + } //note not decreasing bndEntry, because this entry should now be deleted (uninstalled) uninstalled = status == CELIX_SUCCESS; } @@ -1998,7 +2001,9 @@ static bool celix_framework_stopBundleInternal(celix_framework_t* fw, long bndId fw_log(fw->logger, CELIX_LOG_LEVEL_WARNING, "Cannot stop bundle, bundle state is %s", celix_bundleState_getName(state)); } celix_framework_bundleEntry_decreaseUseCount(bndEntry); - celix_framework_waitForBundleEvents(fw, bndId); + if (!forcedAsync) { + celix_framework_waitForBundleEvents(fw, bndId); + } } return stopped; } @@ -2138,7 +2143,9 @@ bool celix_framework_startBundleInternal(celix_framework_t *fw, long bndId, bool started = rc == CELIX_SUCCESS; } celix_framework_bundleEntry_decreaseUseCount(bndEntry); - celix_framework_waitForBundleEvents(fw, bndId); + if (!forcedAsync) { + celix_framework_waitForBundleEvents(fw, bndId); + } } return started; } @@ -2288,7 +2295,9 @@ static bool celix_framework_updateBundleInternal(celix_framework_t *fw, long bnd celix_status_t rc = celix_framework_updateBundleOnANonCelixEventThread(fw, bndEntry, updatedBundleUrl, forcedAsync); //note not decreasing bndEntry, because this entry should now be deleted (uninstalled) updated = rc == CELIX_SUCCESS; - celix_framework_waitForBundleEvents(fw, bndId); + if (!forcedAsync) { + celix_framework_waitForBundleEvents(fw, bndId); + } } return updated; }
