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 36e70143fcceae43b8dd904755911c25d8ecb3b7
Merge: 950e5f65 ab2cc5e6
Author: Pepijn Noltes <[email protected]>
AuthorDate: Sun Jun 11 19:54:37 2023 +0200

    Merge remote-tracking branch 'origin/master' into 
feature/scheduled_event_on_event_thread
    
    # Conflicts:
    #       .clang-format
    #       libs/framework/gtest/CMakeLists.txt
    #       libs/framework/include/celix_dependency_manager.h
    #       libs/framework/src/framework_private.h

 .clang-format                                      |  37 +-
 CMakeLists.txt                                     |   2 +-
 .../admin/src/RemoteServiceAdmin.cc                |   1 +
 bundles/deployment_admin/src/ioapi.c               |   3 +-
 bundles/deployment_admin/src/miniunz.c             |  15 +-
 .../rsa_shm/gtest/CMakeLists.txt                   |   1 +
 .../gtest/src/RsaShmClientServerUnitTestSuite.cc   |   2 +-
 .../src/RsaShmExportRegistrationUnitTestSuite.cc   |  13 +
 .../rsa_shm/gtest/src/RsaShmImplUnitTestSuite.cc   |  22 +
 .../src/RsaShmImportRegistrationUnitTestSuite.cc   |  12 +
 .../rsa_shm/src/rsa_shm_client.c                   |  16 +-
 .../rsa_shm/src/rsa_shm_export_registration.c      |   7 +-
 .../rsa_shm/src/rsa_shm_impl.c                     |   9 +-
 .../rsa_shm/src/rsa_shm_server.c                   |   2 +-
 .../shm_pool/src/shm_cache.c                       |   2 +-
 .../shm_pool/src/shm_pool.c                        |   2 +-
 bundles/remote_services/rsa_common/CMakeLists.txt  |   6 +-
 .../rsa_common/gtest}/CMakeLists.txt               |  27 +-
 .../gtest/src/EndpointDescriptionUnitTestSuite.cc  | 172 ++++++
 .../rsa_common/src/endpoint_description.c          |  34 +-
 .../rsa_rpc_json/gtest/CMakeLists.txt              |   2 +
 .../gtest/src/RsaJsonRpcActivatorUnitTestSuite.cc  |  15 +
 .../gtest/src/RsaJsonRpcUnitTestSuite.cc           |  45 ++
 .../rsa_rpc_json/src/rsa_json_rpc_activator.c      |   7 +-
 .../rsa_rpc_json/src/rsa_json_rpc_endpoint_impl.c  |   8 +-
 .../rsa_rpc_json/src/rsa_json_rpc_proxy_impl.c     |  48 +-
 conanfile.py                                       |  11 +-
 documents/README.md                                |   1 +
 documents/building/README.md                       |   2 +-
 documents/development/README.md                    | 615 +++++++++++++++++++++
 libs/error_injector/CMakeLists.txt                 |   7 +-
 .../CMakeLists.txt                                 |  13 +-
 .../include/celix_hash_map_ei.h}                   |  10 +-
 .../src/celix_hash_map_ei.cc}                      |  14 +-
 .../CMakeLists.txt                                 |  14 +-
 .../include/celix_long_hash_map_ei.h}              |  35 +-
 .../src/celix_long_hash_map_ei.cc}                 |  32 +-
 .../error_injector/celix_properties/CMakeLists.txt |   5 +-
 .../celix_properties/include/celix_properties_ei.h |   1 +
 .../celix_properties/src/celix_properties_ei.cc    |   8 +
 libs/error_injector/stdio/src/stdio_ei.cc          |   2 +-
 .../{celix_properties => unistd}/CMakeLists.txt    |  12 +-
 .../include/unistd_ei.h}                           |  11 +-
 .../src/unistd_ei.cc}                              |  18 +-
 libs/framework/gtest/CMakeLists.txt                |   5 +
 libs/framework/gtest/src/BundleArchiveTestSuite.cc |  27 +-
 .../BundleArchiveWithErrorInjectionTestSuite.cc    | 215 +++++--
 .../src/CelixBundleCacheErrorInjectionTestSuite.cc | 178 ++++++
 .../gtest/src/CelixBundleCacheTestSuite.cc         |  87 +++
 .../src/CelixBundleContextBundlesTestSuite.cc      |  68 +--
 .../gtest/src/DependencyManagerTestSuite.cc        |   4 +-
 libs/framework/include/celix/Bundle.h              |   2 +-
 .../celix/{Exception.h => FrameworkExceptions.h}   |  26 +-
 libs/framework/include/celix/ServiceRegistration.h |   8 +-
 libs/framework/include/celix/Trackers.h            |  15 +-
 libs/framework/include/celix/dm/Component.h        |   2 +-
 libs/framework/include/celix_dependency_manager.h  |  43 +-
 libs/framework/include_deprecated/bundle_archive.h |   7 +-
 libs/framework/src/bundle_archive.c                | 299 +++++-----
 libs/framework/src/bundle_archive_private.h        |  10 +
 libs/framework/src/bundle_revision.c               |   4 +-
 libs/framework/src/celix_bundle_cache.c            | 226 ++++----
 libs/framework/src/celix_bundle_cache.h            |  35 +-
 libs/framework/src/dm_dependency_manager_impl.c    |  17 +-
 libs/framework/src/framework.c                     |  52 +-
 .../src/framework_bundle_lifecycle_handler.c       |   4 +-
 libs/framework/src/framework_private.h             |  14 +-
 libs/pushstreams/api/celix/PushEvent.h             |   2 +-
 libs/pushstreams/api/celix/PushStream.h            |   2 +-
 libs/utils/gtest/src/CelixErrnoTestSuite.cc        |  61 ++
 .../{framework => utils}/include/celix/Exception.h |  17 +-
 libs/utils/include/celix/Filter.h                  |  19 +-
 libs/utils/include/celix_errno.h                   |   9 +-
 libs/utils/include/celix_file_utils.h              |   2 +-
 74 files changed, 2145 insertions(+), 636 deletions(-)

diff --cc .clang-format
index 6f4dbba6,2766cd9c..1069ad00
--- a/.clang-format
+++ b/.clang-format
@@@ -4,24 -5,28 +5,28 @@@ AllowShortIfStatementsOnASingleLine: fa
  AlwaysBreakTemplateDeclarations: Yes
  BinPackArguments: false
  BinPackParameters: false
- BreakBeforeBraces: Attach
  ColumnLimit: 120
- ConstructorInitializerIndentWidth: 4
- Cpp11BracedListStyle: true
  DerivePointerAlignment: false
- IncludeBlocks: Regroup
  KeepEmptyLinesAtTheStartOfBlocks: false
- NamespaceIndentation: None
  PointerAlignment: Left
- ReflowComments: true
- SortIncludes: false
- SpaceAfterCStyleCast: false
- SpaceBeforeAssignmentOperators: true
- SpaceBeforeParens: ControlStatements
- SpaceInEmptyParentheses: false
  SpacesBeforeTrailingComments: 1
- SpacesInAngles: Never
- SpacesInCStyleCastParentheses: false
- SpacesInParentheses: false
- SpacesInSquareBrackets: false
- AlignEscapedNewlines: Right
+ SortIncludes: true
+ ---
 -#Include regroup disabled by default. 
++#Include regroup disabled by default.
+ #IncludeBlocks: Regroup
+ #IncludeCategories:
+ ##gtest headers
+ #  - Regex:            '^((<|")gtest/)'
+ #    Priority:         1
+ ##stdlib C++ headers
+ #  - Regex:            '^<([^.])*>'
+ #    Priority:         2
+ ##external headers
+ #  - Regex:            '^<([^.])*\.h>'
+ #    Priority:         3
+ ##celix C API
+ #  - Regex:            '^(<|")celix_.*'
+ #    Priority:         4
+ ##celix C++ API
+ #  - Regex:            '^(<|")celix/.*'
+ #    Priority:         5
diff --cc documents/README.md
index 4b490e5d,ea646f41..23f0d229
--- a/documents/README.md
+++ b/documents/README.md
@@@ -86,6 -86,6 +86,7 @@@ bundles contains binaries depending on 
    * [Apache Celix Framework](framework.md)
    * [Apache Celix Containers](containers.md)
    * [Apache Celix Patterns](patterns.md)
 +  * [Apache Celix Scheduled Events](scheduled_events.md)
  * [Apache Celix CMake Commands](cmake_commands)
  * [Apache Celix Sub Projects](subprojects.md)
+ * [Apache Celix Coding Conventions Guide](development/README.md)
diff --cc libs/framework/gtest/CMakeLists.txt
index 41eb9ba1,7828126b..4c238a83
--- a/libs/framework/gtest/CMakeLists.txt
+++ b/libs/framework/gtest/CMakeLists.txt
@@@ -56,7 -56,7 +56,8 @@@ set(CELIX_FRAMEWORK_TEST_SOURCE
      src/CxxBundleActivatorTestSuite.cc
      src/BundleArchiveTestSuite.cc
      src/CelixLauncherTestSuite.cc
+     src/CelixBundleCacheTestSuite.cc
 +    src/ScheduledEventTestSuite.cc
  )
  
  add_executable(test_framework ${CELIX_FRAMEWORK_TEST_SOURCES})
@@@ -128,8 -128,8 +129,9 @@@ if (LINKER_WRAP_SUPPORTED
              src/BundleArchiveWithErrorInjectionTestSuite.cc
              src/CelixFrameworkUtilsErrorInjectionTestSuite.cc
              src/CelixBundleContextBundlesWithErrorTestSuite.cc
+             src/CelixBundleCacheErrorInjectionTestSuite.cc
 -            )
 +            src/ScheduledEventWithErrorInjectionTestSuite.cc
 +    )
      target_compile_definitions(test_framework_with_ei PRIVATE
              SIMPLE_TEST_BUNDLE1_LOCATION="${SIMPLE_TEST_BUNDLE1}"
              SIMPLE_CXX_BUNDLE_LOC="${SIMPLE_CXX_BUNDLE_LOC}"
diff --cc libs/framework/include/celix_dependency_manager.h
index a8b4b755,4625fa5d..00d1859d
--- a/libs/framework/include/celix_dependency_manager.h
+++ b/libs/framework/include/celix_dependency_manager.h
@@@ -31,6 -31,8 +31,8 @@@ extern "C" 
  #endif
  
  /**
+  * @file celix_dependency_manager.h
 - * 
++ *
   * The `celix_dependencyManager_add`, `celix_dependencyManager_remove` and 
`celix_dependencyManager_removeAllComponents`
   * funcions for celix_dependency_manager_t should be called outside the Celix 
event thread.
   * Note that bundle activators are started and stopped outside the Celix 
event thread and thus these
@@@ -120,10 -122,9 +122,10 @@@ CELIX_FRAMEWORK_EXPORT bool celix_depen
  CELIX_FRAMEWORK_EXPORT size_t 
celix_dependencyManager_nrOfComponents(celix_dependency_manager_t *manager);
  
  /**
-  * Wait for an empty Celix event queue.
-  * 
+  * @brief Wait for an empty Celix event queue.
 - * 
++ *
   * Should not be called on the Celix event queue thread.
 + * Note scheduled events are not part of the event queue.
   *
   * Can be used to ensure that all created/updated components are completely 
processed (services registered
   * and/or service trackers are created).
@@@ -131,7 -132,8 +133,8 @@@
  CELIX_FRAMEWORK_EXPORT void 
celix_dependencyManager_wait(celix_dependency_manager_t* manager);
  
  /**
-  * Create and returns a dependency manager info struct for the specified 
bundle.
+  * @brief Create and returns a dependency manager info struct for the 
specified bundle.
 - * 
++ *
   * The dependency manager info contains information about the state of the 
dependency manager components
   *
   * Caller has ownership of the return value (use 
celix_dependencyManager_destroyInfo to free the memory).
@@@ -143,7 -146,8 +147,8 @@@
  CELIX_FRAMEWORK_EXPORT celix_dependency_manager_info_t* 
celix_dependencyManager_createInfo(celix_dependency_manager_t *manager, long 
bndId);
  
  /**
-  * Create and returns a dependency manager info struct for all started 
bundles.
+  * @brief Create and returns a dependency manager info struct for all started 
bundles.
 - * 
++ *
   * The dependency manager info contains information about the state of the 
dependency manager components
   *
   * Caller has ownership of the return values (use celix_arrayList_destroy to 
free the memory).
@@@ -165,7 -169,8 +170,8 @@@ CELIX_FRAMEWORK_EXPORT void celix_depen
  CELIX_FRAMEWORK_EXPORT void 
celix_dependencyManager_destroyInfos(celix_dependency_manager_t *manager, 
celix_array_list_t * infos /*entries celix_dependency_manager_info_t*/);
  
  /**
-  * Print the dependency manager info for all bundles to the provided output 
stream.
+  * @brief Print the dependency manager info for all bundles to the provided 
output stream.
 - * 
++ *
   * @param manager The dependency manager.
   * @param fullInfo Whether to print the full info or summary.
   * @param useAnsiColors Whether to use ansi colors when printing info.
@@@ -174,7 -179,8 +180,8 @@@
  CELIX_FRAMEWORK_EXPORT void 
celix_dependencyManager_printInfo(celix_dependency_manager_t* manager, bool 
fullInfo, bool useAnsiColors, FILE* stream);
  
  /**
-  * Print the dependency manager info for the provided bundle id to the 
provided output stream.
+  * @brief Print the dependency manager info for the provided bundle id to the 
provided output stream.
 - * 
++ *
   * @param manager The dependency manager.
   * @param fullInfo whether to print the full info or summary.
   * @param useAnsiColors Whether to use ansi colors when printing info.
diff --cc libs/framework/src/framework_private.h
index b59d0371,47b22c8b..45e2e41a
--- a/libs/framework/src/framework_private.h
+++ b/libs/framework/src/framework_private.h
@@@ -443,75 -433,4 +443,75 @@@ celix_status_t celix_framework_uninstal
   */
  celix_status_t celix_framework_updateBundleEntry(celix_framework_t* fw, 
celix_framework_bundle_entry_t* bndEntry, const char* updatedBundleUrl);
  
 +
 +/** @brief Return the next scheduled event id.
 + * @param[in] fw The Celix framework
 + * @return The next scheduled event id.
 + */
 +long celix_framework_nextScheduledEventId(framework_t *fw);
 +
 +/**
 + * @brief Add a scheduled event to the Celix framework.
 + *
 + *
 + * @param[in] fw The Celix framework
 + * @param[in] bndId The bundle id to add the scheduled event for. If < 0 the 
framework bundle is used.
 + * @param[in] eventName The event name to use for the scheduled event. If 
NULL, a default event name is used.
 + * @param[in] initialDelayInSeconds The initial delay in seconds before the 
first event callback is called.
 + * @param[in] intervalInSeconds The interval in seconds between event 
callbacks.
 + * @param[in] eventData The event data to pass to the event callback.
 + * @param[in] eventCallback The event callback to call when the scheduled 
event is triggered.
 + * @return The scheduled event id of the scheduled event. Can be used to 
cancel the event.
 + * @retval <0 If the event could not be added.
 + */
 +long celix_framework_scheduleEvent(celix_framework_t* fw,
 +                                    long bndId,
 +                                    const char* eventName,
 +                                    double initialDelayInSeconds,
 +                                    double intervalInSeconds,
 +                                    void* callbackData,
 +                                    void (*callback)(void*),
 +                                    void* removeCallbackData,
 +                                    void (*removeCallback)(void*));
-                                        
++
 +/**
 + * @brief Wakeup a scheduled event.
 + *
 + * If waitTimeInSeconds is not 0, this function will block until the 
scheduled event callback is called.
 + * If waitTimeInSeconds is 0, this function will return immediately.
 + *
 + * @param[in] ctx The bundle context.
 + * @param[in] scheduledEventId The scheduled event id to wakeup.
-  * @param[in] waitTimeInSeconds If not 0, this function will block until the 
scheduled event callback 
++ * @param[in] waitTimeInSeconds If not 0, this function will block until the 
scheduled event callback
 + *                              is called or the provided timeout is reached.
-  * @return CELIX_SUCCESS if the scheduled event is woken up, 
CELIX_ILLEGAL_ARGUMENT if the scheduled event id is not 
-  */  
- celix_status_t celix_framework_wakeupScheduledEvent(celix_framework_t* fw, 
-                                                     long scheduledEventId, 
++ * @return CELIX_SUCCESS if the scheduled event is woken up, 
CELIX_ILLEGAL_ARGUMENT if the scheduled event id is not
++ */
++celix_status_t celix_framework_wakeupScheduledEvent(celix_framework_t* fw,
++                                                    long scheduledEventId,
 +                                                    double waitTimeInSeconds);
 +
 +/**
 + * @brief Cancel a scheduled event.
 + *
 + * When this function returns, no more scheduled event callbacks will be 
called.
 + *
 + * @param[in] fw The Celix framework
 + * @param[in] errorIfNotFound If true, removal of a non existing scheduled 
event id will not be logged.
 + * @param[in] scheduledEventId The scheduled event id to cancel.
 + * @return true if a scheduled event is cancelled, false if the scheduled 
event id is not known.
 + */
 +bool celix_framework_removeScheduledEvent(celix_framework_t* fw, bool 
errorIfNotFound, long scheduledEventId);
 +
 +/**
 + * Remove all scheduled events for the provided bundle id and logs warning if 
there are still un-removed scheduled
 + * events that are not a one time event.
 + * @param[in] fw The Celix framework.
 + * @param[in] bndId The bundle id to remove the scheduled events for.
 + */
 +void celix_framework_cleanupScheduledEvents(celix_framework_t* fw, long 
bndId);
 +
 +#ifdef __cplusplus
 +}
 +#endif
 +
  #endif /* FRAMEWORK_PRIVATE_H_ */

Reply via email to