wwbmmm commented on code in PR #3168:
URL: https://github.com/apache/brpc/pull/3168#discussion_r2601926442
##########
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 is not acceptable.
+ static bool SetWorkerIdleCallback(OnWorkerIdleFn fn, void* user_ctx,
Review Comment:
The user interface of bthread should be placed in the
`src/bthread/bthread.h` or `src/bthread/unstable.h`. And it should be C style,
like `bthread_set_worker_idle_callback(xxx)`.
See `bthread_set_worker_startfn` for reference.
--
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]