yanglimingcn commented on code in PR #2920:
URL: https://github.com/apache/brpc/pull/2920#discussion_r2002903964
##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -1486,6 +1527,84 @@ void RdmaEndpoint::GlobalRelease() {
delete res;
}
}
+
+ if (FLAGS_rdma_use_polling) {
+ PollingModeRelease();
+ }
+}
+
+std::vector<RdmaEndpoint::Poller> RdmaEndpoint::_pollers;
+std::atomic<bool> RdmaEndpoint::_running(false);
+std::function<void()> RdmaEndpoint::_callback(nullptr);
+butil::Mutex RdmaEndpoint::_cb_mutex;
+
+void RdmaEndpoint::SetCallbackFn(std::function<void()> cb) { _callback = cb; }
+
+int RdmaEndpoint::PollingModeInitialize() {
+ auto fn = [](void* args) -> void* {
+ auto poller = static_cast<Poller*>(args);
+ while (_running.load(butil::memory_order_relaxed)) {
+ std::list<Socket*> sockets;
+ {
+ std::unique_lock<butil::Mutex> lk(poller->mutex);
+ sockets = poller->sockets; // copy all sockets is not good
Review Comment:
这个socket属于一个RdmaEndpoint,RdmaEndpoint销毁的时候会把它从链表删掉。
--
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]