ivanallen commented on code in PR #2920:
URL: https://github.com/apache/brpc/pull/2920#discussion_r2004616663


##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -1486,6 +1527,88 @@ void RdmaEndpoint::GlobalRelease() {
             delete res;
         }
     }
+
+    if (FLAGS_rdma_use_polling) {
+        PollingModeRelease();
+    }
+}
+
+std::vector<RdmaEndpoint::Poller> RdmaEndpoint::_pollers;
+std::atomic<bool> RdmaEndpoint::_running(false);
+
+void RdmaEndpoint::SetCallbackFn(std::function<void()> cb) {
+    for (int i = 0; i < FLAGS_rdma_poller_num; ++i) {
+        auto& poller = _pollers[i];
+        std::unique_lock<bthread::Mutex> lk(poller.callback_mutex);
+        poller.callback = cb;

Review Comment:
   这个修改,最终所有的 poller 调用的 callback 还是同一个吧。
   
   ```
   SetCallbackFn([]() {
       // dosomething
   });
   ```
   
   不过接口设计上确实有点麻烦,可能回调函数的参数,传一个 poller_id 给用户,可能也行。
   比如这样:
   ```
   SetCallbackFn([](int poller_id) {
       // do something.
       user_poller[poller_id]->poll();
   });
   ```
   
   



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