11#include <sys/resource.h>
19 IoLoop(
const condy::RuntimeOptions &options,
size_t nr_files,
20 size_t nr_buffers, cpu_set_t cpuset)
23 int r = runtime_.fd_table().init(nr_files);
25 throw std::system_error(-r, std::generic_category(),
30 int r = runtime_.buffer_table().init(nr_buffers);
32 throw std::system_error(-r, std::generic_category(),
36 thread_ = std::jthread([
this, cpuset] { run_(cpuset); });
39 IoLoop(
const IoLoop &) =
delete;
40 IoLoop &operator=(
const IoLoop &) =
delete;
41 IoLoop(IoLoop &&) =
delete;
42 IoLoop &operator=(IoLoop &&) =
delete;
44 ~IoLoop() { runtime_.allow_exit(); }
47 auto get_scheduler() noexcept {
return condy::get_scheduler(runtime_); }
49 auto &runtime() noexcept {
return runtime_; }
52 void run_(cpu_set_t cpuset) {
53 pthread_setaffinity_np(pthread_self(),
sizeof(cpu_set_t), &cpuset);
54 setpriority(PRIO_PROCESS, 0, -20);
55#if defined(PR_SET_IO_FLUSHER)
56 prctl(PR_SET_IO_FLUSHER, 1, 0, 0, 0);
62 condy::Runtime runtime_;
The main namespace of the ublk-cpp library.