Skip to content
Snippets Groups Projects

[IO] make the lock implementation protecting a IoContext's cq configurable 

Merged Florian Fischer requested to merge aj46ezos/emper:cq_lock2 into master
5 files
+ 83
2
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 20
2
@@ -18,10 +18,28 @@
#include "emper-config.h" // for EMPER_IO_WORKER_URING_ENTRIES
#include "io/Stats.hpp" // for Stats
#include "lib/adt/LockedSet.hpp" // for LockedSet
#include "lib/sync/CountingTryLock.hpp"
class Fiber;
#ifdef EMPER_IO_CQ_LOCK_COUNTING_TRY_LOCK
#include "lib/sync/CountingTryLock.hpp"
using CqLock = emper::lib::sync::CountingTryLock;
#elif defined EMPER_IO_CQ_LOCK_MUTEX
#include <mutex>
#include "lib/sync/PseudoCountingTryLock.hpp"
using CqLock = emper::lib::sync::PseudoCountingTryLock<std::mutex>;
#elif defined EMPER_IO_CQ_LOCK_SPIN_LOCK
#include "lib/sync/PseudoCountingTryLock.hpp"
#include "lib/sync/SpinLock.hpp"
using CqLock = emper::lib::sync::PseudoCountingTryLock<emper::lib::sync::SpinLock>;
#else
#error Uknown cq lock implementation
#endif
namespace emper::io {
class Future;
@@ -40,7 +58,7 @@ class IoContext : public Logger<LogSubsystem::IO> {
static thread_local IoContext *workerIo;
// TryLock protecting the completion queue of ring.
ALIGN_TO_CACHE_LINE lib::sync::CountingTryLock cq_lock;
ALIGN_TO_CACHE_LINE CqLock cq_lock;
struct io_uring ring;
// In a worker's IoContext This eventfd is registered with the io_uring to get completion
Loading