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


##########
libs/framework/src/framework_private.h:
##########
@@ -437,4 +447,83 @@ celix_status_t 
celix_framework_uninstallBundleEntry(celix_framework_t* fw, celix
  */
 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 and returns immediately, not waiting for 
the scheduled event callback to be
+ * called.
+ *
+ * @param[in] ctx The bundle context.
+ * @param[in] scheduledEventId The scheduled event id to wakeup.
+ * @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);
+
+/**
+ * @brief Wait for the next scheduled event to be processed.
+ * @param[in] fw The Celix framework
+ * @param[in] scheduledEventId The scheduled event id to wait for.
+ * @param[in] waitTimeInSeconds The maximum time to wait for the next 
scheduled event. If <= 0 the function will return
+ *                             immediately.
+ * @return CELIX_SUCCESS if the scheduled event is woken up, 
CELIX_ILLEGAL_ARGUMENT if the scheduled event id is not
+ *         known and ETIMEDOUT if the waitTimeInSeconds is reached.
+ */
+celix_status_t celix_framework_waitForScheduledEvent(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] async If true, the scheduled event will be cancelled 
asynchronously and the function will not block.
+ * @param[in] errorIfNotFound If true, removal of a non existing scheduled 
event id will not be logged.

Review Comment:
   Quick fix: 
https://github.com/apache/celix/pull/583/commits/0273072e8bdb43e3f9ce47b2ca51a3109591d65f



-- 
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