ZhengweiZhu commented on code in PR #3096:
URL: https://github.com/apache/brpc/pull/3096#discussion_r2432672235
##########
src/bthread/task_control.cpp:
##########
@@ -587,4 +587,21 @@ bvar::LatencyRecorder*
TaskControl::create_exposed_pending_time() {
return pt;
}
+std::vector<bthread_t> TaskControl::get_all_bthreads() {
+ std::vector<bthread_t> all_bthread_ids;
+ std::vector<TaskMeta*> all_tasks = butil::list_resources<TaskMeta>();
+ all_bthread_ids.reserve(all_tasks.size());
+ for (TaskMeta* m : all_tasks) {
+ // filter out those bthreads created by bthread_start* functions,
+ // i.e. not those created internally to run main task as they are
+ // opaque to user
+ if (m && !m->main_task) {
Review Comment:
It works to use m->fn != NULL to judge
--
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]