event/Loop: integrate io_uring support

This commit is contained in:
Max Kellermann
2020-05-05 15:18:02 +02:00
parent 62d0ceabcc
commit cdf8ac001c
5 changed files with 159 additions and 0 deletions

View File

@@ -38,6 +38,12 @@
#include <cassert>
#include <chrono>
#include "io/uring/Features.h"
#ifdef HAVE_URING
#include <memory>
namespace Uring { class Queue; class Manager; }
#endif
/**
* An event loop that polls for events on file/socket descriptors.
*
@@ -82,6 +88,10 @@ class EventLoop final : SocketMonitor
boost::intrusive::constant_time_size<false>> DeferredList;
DeferredList deferred;
#ifdef HAVE_URING
std::unique_ptr<Uring::Manager> uring;
#endif
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
/**
@@ -108,6 +118,10 @@ class EventLoop final : SocketMonitor
*/
bool busy = true;
#ifdef HAVE_URING
bool uring_initialized = false;
#endif
PollGroup poll_group;
PollResult poll_result;
@@ -135,6 +149,11 @@ public:
return now;
}
#ifdef HAVE_URING
gcc_pure
Uring::Queue *GetUring() noexcept;
#endif
/**
* Stop execution of this #EventLoop at the next chance. This
* method is thread-safe and non-blocking: after returning, it