mirror of
https://github.com/decompals/wibo.git
synced 2025-12-12 14:46:09 +00:00
* Add hybrid epoll/thread pool async I/O backend * Remove thread pool in favor of epoll AIO backend
34 lines
872 B
C++
34 lines
872 B
C++
#pragma once
|
|
|
|
#include "kernel32/internal.h"
|
|
#include "kernel32/minwinbase.h"
|
|
|
|
#include <optional>
|
|
|
|
namespace wibo {
|
|
|
|
class AsyncIOBackend {
|
|
public:
|
|
virtual ~AsyncIOBackend() = default;
|
|
virtual bool init() = 0;
|
|
virtual void shutdown() = 0;
|
|
[[nodiscard]] virtual bool running() const noexcept = 0;
|
|
virtual bool queueRead(Pin<kernel32::FileObject> file, OVERLAPPED *ov, void *buffer, DWORD length,
|
|
const std::optional<off_t> &offset, bool isPipe) = 0;
|
|
virtual bool queueWrite(Pin<kernel32::FileObject> file, OVERLAPPED *ov, const void *buffer, DWORD length,
|
|
const std::optional<off_t> &offset, bool isPipe) = 0;
|
|
};
|
|
|
|
namespace detail {
|
|
|
|
#if WIBO_ENABLE_LIBURING
|
|
std::unique_ptr<AsyncIOBackend> createIoUringBackend();
|
|
#endif
|
|
std::unique_ptr<AsyncIOBackend> createEpollBackend();
|
|
|
|
} // namespace detail
|
|
|
|
AsyncIOBackend &asyncIO();
|
|
|
|
} // namespace wibo
|