diff --git a/test_loop b/test_loop index 155c2aa..1d80a3f 100755 Binary files a/test_loop and b/test_loop differ diff --git a/uring.cc b/uring.cc index 292a5d7..4311509 100644 --- a/uring.cc +++ b/uring.cc @@ -39,6 +39,13 @@ bool URing::Try() { return false; } +void URing::nop(const std::function &callback) { + auto *entry = GetEntry(callback); + auto *sqe = GetSQE(); + io_uring_prep_nop(sqe); + io_uring_sqe_set_data(sqe, reinterpret_cast(entry)); +} + void URing::write(int fd, const void *buf, size_t count, const std::function &callback) { std::vector vecs{ diff --git a/uring.h b/uring.h index ab12ad9..66a3bea 100644 --- a/uring.h +++ b/uring.h @@ -13,6 +13,8 @@ class URing { URing(uint32_t num_entries); ~URing(); + void nop(const std::function &callback); + // TODO: write/writev don't work for files because they always use offset 0 void write(int fd, const void *buf, size_t count, const std::function &callback);