From 5a3c5e7358aaa29c07045690e4fe9e7cb63bae79 Mon Sep 17 00:00:00 2001 From: dong--jie Date: Thu, 7 Aug 2025 10:59:04 +0800 Subject: [PATCH] add warnings for using exit in callbacks Signed-off-by: dong--jie --- resourceschedule/ffrt/c/loop.h | 3 +++ resourceschedule/ffrt/c/queue.h | 1 + resourceschedule/ffrt/c/timer.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/resourceschedule/ffrt/c/loop.h b/resourceschedule/ffrt/c/loop.h index 35d76cedb..62aee092a 100644 --- a/resourceschedule/ffrt/c/loop.h +++ b/resourceschedule/ffrt/c/loop.h @@ -88,6 +88,8 @@ FFRT_C_API void ffrt_loop_stop(ffrt_loop_t loop); /** * @brief Controls an epoll file descriptor on ffrt loop. * + * @warning Do not call `exit` in `cb` - this my cause unexpected behavior. + * * @param loop Indicates a loop handle. * @param op Indicates operation on the target file descriptor. * @param fd Indicates the target file descriptor on which to perform the operation. @@ -103,6 +105,7 @@ FFRT_C_API int ffrt_loop_epoll_ctl(ffrt_loop_t loop, int op, int fd, uint32_t ev /** * @brief Starts a timer on ffrt loop. * + * @warning Do not call `exit` in `cb` - this my cause unexpected behavior. * @param loop Indicates a loop handle. * @param timeout Indicates the number of milliseconds that specifies timeout. * @param data Indicates user data used in cb. diff --git a/resourceschedule/ffrt/c/queue.h b/resourceschedule/ffrt/c/queue.h index cd82aa80c..86b80252e 100644 --- a/resourceschedule/ffrt/c/queue.h +++ b/resourceschedule/ffrt/c/queue.h @@ -118,6 +118,7 @@ FFRT_C_API uint64_t ffrt_queue_attr_get_timeout(const ffrt_queue_attr_t* attr); /** * @brief Sets the timeout callback function of a serial queue attribute. * + * @warning Do not call `exit` in `f` - this my cause unexpected behavior. * @param attr Serial queue attribute pointer. * @param f Serial queue timeout callback function. * @since 10 diff --git a/resourceschedule/ffrt/c/timer.h b/resourceschedule/ffrt/c/timer.h index 1f13a4dff..ddc730121 100644 --- a/resourceschedule/ffrt/c/timer.h +++ b/resourceschedule/ffrt/c/timer.h @@ -42,6 +42,8 @@ /** * @brief Starts a timer on ffrt worker * + * @warning Do not call `exit` in `cb` - this my cause unexpected behavior. + * * @param qos Indicates qos of the worker that runs timer. * @param timeout Indicates the number of milliseconds that specifies timeout. * @param data Indicates user data used in cb. -- Gitee