io/uring/Queue: make Submit() virtual, Push() not

This allows submitting io_uring calls without an `Operation` instance
(fire & forget).  We'll do that for close().
This commit is contained in:
Max Kellermann 2023-03-23 12:01:35 +01:00 committed by Max Kellermann
parent 6496c1b806
commit 26577d1301
4 changed files with 6 additions and 8 deletions

View File

@ -20,7 +20,7 @@ void
Manager::OnIdle() noexcept Manager::OnIdle() noexcept
{ {
try { try {
Submit(); Queue::Submit();
} catch (...) { } catch (...) {
PrintException(std::current_exception()); PrintException(std::current_exception());
} }

View File

@ -23,9 +23,7 @@ public:
event.ScheduleRead(); event.ScheduleRead();
} }
void Push(struct io_uring_sqe &sqe, void Submit() override {
Operation &operation) noexcept override {
AddPending(sqe, operation);
idle_event.Schedule(); idle_event.Schedule();
} }

View File

@ -27,7 +27,7 @@ Queue::RequireSubmitEntry()
if (sqe == nullptr) { if (sqe == nullptr) {
/* the submit queue is full; submit it to the kernel /* the submit queue is full; submit it to the kernel
and try again */ and try again */
Submit(); ring.Submit();
sqe = GetSubmitEntry(); sqe = GetSubmitEntry();
if (sqe == nullptr) if (sqe == nullptr)

View File

@ -52,13 +52,13 @@ protected:
Operation &operation) noexcept; Operation &operation) noexcept;
public: public:
virtual void Push(struct io_uring_sqe &sqe, void Push(struct io_uring_sqe &sqe,
Operation &operation) noexcept { Operation &operation) noexcept {
AddPending(sqe, operation); AddPending(sqe, operation);
Submit(); Submit();
} }
void Submit() { virtual void Submit() {
ring.Submit(); ring.Submit();
} }