Use a separate thread for epoll

Simplest, but absolutely inefficient, way to test openonload epoll
This commit is contained in:
Vitaliy Filippov
2020-06-09 00:52:43 +03:00
parent 2498e504c2
commit 85010fed38
3 changed files with 71 additions and 31 deletions
+7 -1
View File
@@ -12,6 +12,8 @@
#include <set>
#include <deque>
#include <mutex>
#include <thread>
#include "blockstore.h"
#include "ringloop.h"
@@ -114,6 +116,10 @@ class osd_t
int wait_state = 0;
int epoll_fd = 0;
int event_fd = 0;
std::thread *epoll_thread = NULL;
std::mutex epoll_mutex;
std::map<int, int> epoll_ready;
int listening_port = 0;
int listen_fd = 0;
ring_consumer_t consumer;
@@ -150,7 +156,7 @@ class osd_t
// event loop, socket read/write
void loop();
void set_fd_handler(int fd, std::function<void(int, int)> handler);
void handle_epoll_events();
void handle_eventfd();
// peer handling (primary OSD logic)
void parse_test_peer(std::string peer);