wwbmmm commented on code in PR #2819:
URL: https://github.com/apache/brpc/pull/2819#discussion_r1875149987


##########
src/brpc/event_dispatcher.cpp:
##########
@@ -55,6 +55,7 @@ void InitializeGlobalDispatchers() {
                 FLAGS_usercode_in_pthread ? BTHREAD_ATTR_PTHREAD : 
BTHREAD_ATTR_NORMAL;
             attr.tag = (BTHREAD_TAG_DEFAULT + i) % FLAGS_task_group_ntags;
             CHECK_EQ(0, g_edisp[i * FLAGS_event_dispatcher_num + 
j].Start(&attr));
+            bthread_epoll_tid_set(i, g_edisp[i].Tid());

Review Comment:
   这里应该是 g_edisp[i * FLAGS_event_dispatcher_num + j] 吧?



##########
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:
   简单getter用小写开头的全名方式



##########
src/bthread/parking_lot.h:
##########
@@ -30,6 +30,7 @@ namespace bthread {
 // Park idle workers.
 class BAIDU_CACHELINE_ALIGNMENT ParkingLot {
 public:
+    static butil::atomic<int> _waiting_count;

Review Comment:
   这个变量不应该是public的,可以提供一个getter函数



##########
src/bthread/task_group.h:
##########
@@ -189,6 +190,11 @@ class TaskGroup {
 
     bthread_tag_t tag() const { return _tag; }
 
+    // Thread Unsafe
+    void add_epoll_tid(bthread_t tid) { _epoll_tids.emplace(tid); }
+
+    bool cur_epoll_tid() { return _epoll_tids.count(current_tid()) > 0; }

Review Comment:
   叫is_current_epoll_tid更合适?



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

Reply via email to