chenBright commented on code in PR #2819: URL: https://github.com/apache/brpc/pull/2819#discussion_r1992640728
########## src/bthread/task_group.h: ########## @@ -199,6 +200,10 @@ class TaskGroup { total_ns += butil::cputhread_time_ns() - _last_cpu_clock_ns; return total_ns; } + // Thread Unsafe + void add_epoll_tid(bthread_t tid) { _epoll_tids.emplace(tid); } Review Comment: 高优标记放在bthread TaskMeta::attr::flags中,是不是更合适?未来有其他高优需求,就不需要再额外支持了。 ########## src/bthread/task_group.h: ########## @@ -278,6 +285,7 @@ friend class TaskControl; // Worker thread id. pid_t _tid; + std::unordered_set<bthread_t> _epoll_tids; Review Comment: 用butil::FlatSet? ########## src/bthread/task_control.cpp: ########## @@ -575,4 +586,11 @@ bvar::LatencyRecorder* TaskControl::create_exposed_pending_time() { return pt; } +void TaskControl::set_group_epoll_tid(bthread_tag_t tag, bthread_t tid) { + auto groups = tag_group(tag); + const size_t ngroup = tag_ngroup(tag).load(butil::memory_order_acquire); Review Comment: groups.load()? ########## src/brpc/event_dispatcher.h: ########## @@ -133,6 +133,8 @@ template <typename T> friend class IOEvent; // Returns 0 on success, -1 otherwise and errno is set int UnregisterEvent(IOEventDataId event_data_id, int fd, bool pollin); + bthread_t Tid() const { return _tid; } Review Comment: +1 ########## src/bthread/task_control.h: ########## @@ -96,6 +97,12 @@ friend bthread_t init_for_pthread_stack_trace(); void stack_trace(std::ostream& os, bthread_t tid); std::string stack_trace(bthread_t tid); #endif // BRPC_BTHREAD_TRACER + // Only deal once when init epoll bthread. + void set_group_epoll_tid(bthread_tag_t tag, bthread_t tid); + + void push_priority_q(bthread_tag_t tag, bthread_t tid) { + _priority_qs[tag].push(tid); Review Comment: 如果_priority_qs扩容了,是不是会有问题? -- 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: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org