pnoltes commented on PR #627: URL: https://github.com/apache/celix/pull/627#issuecomment-2111030126
> Two weeks have passed and I wanted to share again my progress :) > > **BundleContext lifetime** Another way I came up with is to hand out a BundleContext to the bundle and having an Arc<(Condvar, Mutex)> flag in the BundleContext (not accessible by the BundleContexts API). When the BundleContext is dropped, the flag is set and the Condvar is notified. A copy of that Arc is stored in the internal part of the activator. When the stop/delete function of the bundle is invoked the flag is checked periodically if it is set. By using the Condvar we can block between these checks (and also log an error similar to the cpp API). > This is indeed close to what C++ is doing and that case a `weak_ptr` is used during bundle stop a runtime check and wait is made to ensure there are no users of the BundleContext anymore. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
