royguo commented on code in PR #3168:
URL: https://github.com/apache/brpc/pull/3168#discussion_r2601430534
##########
src/bthread/task_group.h:
##########
@@ -115,6 +115,15 @@ class TaskGroup {
static void sched_to(TaskGroup** pg, bthread_t next_tid);
static void exchange(TaskGroup** pg, TaskMeta* next_meta);
+ typedef bool (*OnWorkerIdleFn)(void* user_ctx);
+ // Set a callback to run when a worker has no task to run.
+ // If the callback returns true, it means some work is done and the worker
+ // should check the runqueue again immediately.
+ // |timeout_us|: The timeout for waiting if the callback returns false.
+ // 0 means infinite wait (original behavior).
+ static void SetWorkerIdleCallback(OnWorkerIdleFn fn, void* user_ctx,
+ uint64_t timeout_us = 1000);
Review Comment:
will not fix, we use atomic flag to make sure the function will only be set
once.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]