pnoltes commented on code in PR #583:
URL: https://github.com/apache/celix/pull/583#discussion_r1251087171


##########
libs/framework/src/framework.c:
##########
@@ -1195,19 +1195,15 @@ static void* framework_shutdown(void *framework) {
     celix_arrayList_destroy(stopEntries);
 
 
-    // 'stop' framework bundle
+    // make sure the framework has been stopped
     if (fwEntry != NULL) {
-        bundle_t *bnd = fwEntry->bnd;
-        fw_bundleEntry_waitTillUseCountIs(fwEntry, 1); //note this function 
has 1 use count.
-
-        bundle_state_e state;
-        bundle_getState(bnd, &state);
-        if (state == CELIX_BUNDLE_STATE_ACTIVE || state == 
CELIX_BUNDLE_STATE_STARTING) {
-            celix_framework_stopBundleEntry(fw, fwEntry);
-        }
+        // Lock the mutex to make sure that 
`celix_framework_stopBundleEntryInternal` on the framework has finished.
+        celixThreadRwlock_readLock(&fwEntry->fsmMutex);

Review Comment:
   :+1: , this works as nice clean sync.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to