This is an automated email from the ASF dual-hosted git repository. pnoltes pushed a commit to branch feature/scheduled_event_on_event_thread in repository https://gitbox.apache.org/repos/asf/celix.git
commit 24ec81760b5343c4878f74cf127158bf42401660 Merge: ba22bf22 24d624ef Author: Pepijn Noltes <[email protected]> AuthorDate: Fri Jun 16 19:24:07 2023 +0200 Merge remote-tracking branch 'origin/master' into feature/scheduled_event_on_event_thread # Conflicts: # libs/framework/gtest/src/CelixFrameworkTestSuite.cc # libs/framework/src/framework.c .github/workflows/macos.yml | 5 +- .github/workflows/ubuntu.yml | 4 +- bundles/pubsub/integration/gtest/tst_activator.c | 6 +- .../src/pubsub_topology_manager.c | 2 +- .../remote_service_admin_dfi/CMakeLists.txt | 1 - .../remote_services/rsa_rpc_json/CMakeLists.txt | 1 - bundles/shell/shell/CMakeLists.txt | 1 + bundles/shell/shell/gtest/src/ShellTestSuite.cc | 3 + bundles/shell/shell/src/query_command.c | 3 +- bundles/shell/shell/src/std_commands.c | 9 +- bundles/shell/shell/src/std_commands.h | 2 + bundles/shell/shell/src/unload_command.c | 24 ++ cmake/cmake_celix/BundlePackaging.cmake | 70 ++-- conanfile.py | 10 +- examples/conan_test_package/conanfile.py | 10 +- libs/framework/gtest/CMakeLists.txt | 3 +- libs/framework/gtest/src/BundleArchiveTestSuite.cc | 27 +- .../BundleArchiveWithErrorInjectionTestSuite.cc | 42 +- .../src/CelixBundleCacheErrorInjectionTestSuite.cc | 2 +- .../gtest/src/CelixBundleCacheTestSuite.cc | 16 +- .../src/CelixBundleContextBundlesTestSuite.cc | 153 +++++++- .../framework/gtest/src/CelixFrameworkTestSuite.cc | 28 +- libs/framework/include/celix_bundle.h | 2 + libs/framework/include/celix_bundle_context.h | 19 +- libs/framework/include/celix_framework.h | 97 ++++- libs/framework/src/bundle.c | 30 +- libs/framework/src/bundle_archive.c | 39 +- libs/framework/src/bundle_context.c | 12 +- libs/framework/src/bundle_context_private.h | 27 +- libs/framework/src/bundle_revision.c | 27 +- libs/framework/src/celix_bundle_cache.c | 6 +- libs/framework/src/celix_bundle_cache.h | 11 +- libs/framework/src/dm_dependency_manager_impl.c | 27 +- libs/framework/src/framework.c | 431 ++++++++++++--------- .../src/framework_bundle_lifecycle_handler.c | 20 +- libs/framework/src/framework_private.h | 18 +- 36 files changed, 735 insertions(+), 453 deletions(-) diff --cc libs/framework/gtest/src/CelixFrameworkTestSuite.cc index 92c9d0d1,95e7d434..b187453a --- a/libs/framework/gtest/src/CelixFrameworkTestSuite.cc +++ b/libs/framework/gtest/src/CelixFrameworkTestSuite.cc @@@ -79,27 -79,7 +79,26 @@@ TEST_F(CelixFrameworkTestSuite, EventQu EXPECT_EQ(4, count); } +TEST_F(CelixFrameworkTestSuite, TimedWaitEventQueueTest) { + //When there is a emtpy event queue + celix_framework_waitForEmptyEventQueue(framework.get()); + + //And a generic event is fired, that block the queue for 20ms + auto callback = [](void* /*data*/) { + std::this_thread::sleep_for(std::chrono::milliseconds{20}); + }; + celix_framework_fireGenericEvent(framework.get(), -1L, -1L, "test", nullptr, callback, nullptr, nullptr); + + //Then a wait for empty event queue for max 5ms will return a timeout + celix_status_t status = celix_framework_timedWaitForEmptyEventQueue(framework.get(), 0.005); + EXPECT_EQ(CELIX_TIMEOUT, status); + + //And a wait for empty event queue for max 30ms will return success + status = celix_framework_timedWaitForEmptyEventQueue(framework.get(), 0.03); + EXPECT_EQ(CELIX_SUCCESS, status); +} + - - TEST_F(CelixFrameworkTestSuite, AsyncInstallStartStopAndUninstallBundleTest) { + TEST_F(CelixFrameworkTestSuite, AsyncInstallStartStopUpdateAndUninstallBundleTest) { long bndId = celix_framework_installBundleAsync(framework.get(), SIMPLE_TEST_BUNDLE1_LOCATION, false); EXPECT_GE(bndId, 0); EXPECT_TRUE(celix_framework_isBundleInstalled(framework.get(), bndId)); diff --cc libs/framework/src/framework.c index f9b3dcdf,0a2d1dc6..3a7619a1 --- a/libs/framework/src/framework.c +++ b/libs/framework/src/framework.c @@@ -17,32 -17,35 +17,36 @@@ * under the License. */ + #include <assert.h> + #include <celix_log_utils.h> + #include <stdbool.h> + #include <stdio.h> #include <stdlib.h> #include <string.h> - #include <stdbool.h> + #include <unistd.h> #include <uuid/uuid.h> - #include <assert.h> - #include "celix_log_utils.h" + #include "celix_build_assert.h" + #include "celix_bundle_context.h" + #include "celix_constants.h" + #include "celix_convert_utils.h" #include "celix_dependency_manager.h" + #include "celix_file_utils.h" + #include "celix_framework_utils_private.h" + #include "celix_libloader.h" + #include "celix_log_constants.h" + #include "celix_module_private.h" + + #include "bundle_archive_private.h" + #include "bundle_context_private.h" + #include "bundle_private.h" #include "framework_private.h" - #include "celix_constants.h" - #include "resolver.h" - #include "utils.h" #include "linked_list_iterator.h" + #include "resolver.h" #include "service_reference_private.h" #include "service_registration_private.h" - #include "bundle_private.h" - #include "celix_bundle_context.h" - #include "bundle_context_private.h" - #include "celix_libloader.h" - #include "celix_log_constants.h" - #include "celix_framework_utils_private.h" - #include "bundle_archive_private.h" - #include "celix_module_private.h" - #include "celix_convert_utils.h" +#include "celix_scheduled_event.h" - #include "celix_build_assert.h" + #include "utils.h" struct celix_bundle_activator { void * userData; diff --cc libs/framework/src/framework_private.h index bd37b6b9,d2a36cfc..acf6f8ac --- a/libs/framework/src/framework_private.h +++ b/libs/framework/src/framework_private.h @@@ -38,13 -37,11 +38,14 @@@ #include "bundle_context.h" #include "celix_bundle_cache.h" #include "celix_log.h" - #include "celix_threads.h" #include "service_registry.h" + #include <stdbool.h> +#ifdef __cplusplus +extern "C" { +#endif + #ifndef CELIX_FRAMEWORK_DEFAULT_STATIC_EVENT_QUEUE_SIZE #define CELIX_FRAMEWORK_DEFAULT_STATIC_EVENT_QUEUE_SIZE 1024 #endif
