PengZheng commented on code in PR #583: URL: https://github.com/apache/celix/pull/583#discussion_r1259115854
########## libs/framework/include/celix_bundle_context.h: ########## @@ -1253,6 +1253,143 @@ CELIX_FRAMEWORK_EXPORT celix_dependency_manager_t* celix_bundleContext_getDepend */ CELIX_FRAMEWORK_EXPORT void celix_bundleContext_waitForEvents(celix_bundle_context_t *ctx); +/** + * @struct celix_scheduled_event_options + * @brief Celix scheduled event options, used for creating scheduling events with the celix framework. + */ +typedef struct celix_scheduled_event_options { + const char* name CELIX_OPTS_INIT; /**< + * @brief The name of the event, used for logging and debugging. + * + * Expected to be const char* that is valid during the celix_bundleContext_scheduleEvent + * call. Can be NULL. */ + + double initialDelayInSeconds CELIX_OPTS_INIT; /**< @brief Initial delay in seconds before the event is processed.*/ + + double intervalInSeconds CELIX_OPTS_INIT; /**< @brief Schedule interval in seconds. + * 0 means one-shot scheduled event. + */ + + void* callbackData CELIX_OPTS_INIT; /**< @brief Data passed to the callback function when a event is scheduled.*/ + + void (*callback)(void* callbackData) CELIX_OPTS_INIT; /**< @brief Callback function called to process a scheduled + event. Will be called on the event thread.*/ + + void* removeCallbackData + CELIX_OPTS_INIT; /**< @brief Data passed to the done callback function when a scheduled event is removed.*/ + + void (*removeCallback)(void* removeCallbackData) + CELIX_OPTS_INIT; /**< @brief Callback function called when a scheduled event is removed. Will be called on + the event thread.*/ +} celix_scheduled_event_options_t; + +#define CELIX_EMPTY_SCHEDULED_EVENT_OPTIONS {NULL, 0.0, 0.0, NULL, NULL, NULL, NULL} + +/** + * @brief Add a scheduled event to the Celix framework. + * + * The scheduled event will be called on the Celix framework event thread, repeatedly using the provided interval or + * once if only a initial delay is provided. + * The event callback should be relatively fast and the scheduled event interval should be relatively high, otherwise Review Comment: ```suggestion * The event callback should be relatively fast and the scheduled event interval should be relatively long, otherwise ``` -- 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