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:
parent
6496c1b806
commit
26577d1301
@ -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());
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user