MalikHou commented on code in PR #3168:
URL: https://github.com/apache/brpc/pull/3168#discussion_r2601244520


##########
src/bthread/task_group.cpp:
##########
@@ -78,6 +78,23 @@ BAIDU_VOLATILE_THREAD_LOCAL(void*, tls_unique_user_ptr, 
NULL);
 
 const TaskStatistics EMPTY_STAT = { 0, 0, 0 };
 
+TaskGroup::OnWorkerIdleFn TaskGroup::_worker_idle_cb = NULL;
+void* TaskGroup::_worker_idle_ctx = NULL;
+uint64_t TaskGroup::_worker_idle_timeout_us = 1000;
+
+// Set the global static idle task, we can use thread local variables to 
distinct different
+// task group's target resource (for example, users' can init thread local 
iouring per task group).
+void TaskGroup::SetWorkerIdleCallback(OnWorkerIdleFn fn, void* user_ctx,
+                                      uint64_t timeout_us) {

Review Comment:
   `SetWorkerIdleCallback` should be protected against setting any scheduling 
points after the task group starts



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

Reply via email to