26577d1301
This allows submitting io_uring calls without an `Operation` instance (fire & forget). We'll do that for close().
36 lines
680 B
C++
36 lines
680 B
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
// Copyright The Music Player Daemon Project
|
|
|
|
#pragma once
|
|
|
|
#include "PipeEvent.hxx"
|
|
#include "IdleEvent.hxx"
|
|
#include "io/uring/Queue.hxx"
|
|
|
|
namespace Uring {
|
|
|
|
class Manager final : public Queue {
|
|
PipeEvent event;
|
|
IdleEvent idle_event;
|
|
|
|
public:
|
|
explicit Manager(EventLoop &event_loop)
|
|
:Queue(1024, 0),
|
|
event(event_loop, BIND_THIS_METHOD(OnSocketReady),
|
|
GetFileDescriptor()),
|
|
idle_event(event_loop, BIND_THIS_METHOD(OnIdle))
|
|
{
|
|
event.ScheduleRead();
|
|
}
|
|
|
|
void Submit() override {
|
|
idle_event.Schedule();
|
|
}
|
|
|
|
private:
|
|
void OnSocketReady(unsigned flags) noexcept;
|
|
void OnIdle() noexcept;
|
|
};
|
|
|
|
} // namespace Uring
|