Files
moloapp/src/runtime/poller_kqueue.h
T
retoor 3c4334cec9 feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security,
data, app, realtime, supervisor, clients, CLI, example plus
enterprise tenancy, audit, operability, governance,
supplychain. Postgres via docker compose for tests.
2026-10-23 18:20:04 +02:00

37 lines
1003 B
C++

// Spec: plans/01-runtime.md 6.1. kqueue backend for BSD/macOS. On other
// platforms this compiles to a stub that reports unsupported; MakePoller
// never selects it there.
#pragma once
#include <cstddef>
#include <cstdint>
#include <unordered_map>
#include "poller.h"
namespace molo::runtime {
class KqueuePoller : public IPoller {
public:
KqueuePoller();
~KqueuePoller() override;
KqueuePoller(const KqueuePoller&) = delete;
KqueuePoller& operator=(const KqueuePoller&) = delete;
bool valid() const { return kq_ >= 0; }
bool add_fd(int fd, uint32_t events, Callback cb) override;
bool modify_fd(int fd, uint32_t events) override;
void remove_fd(int fd) override;
int wait(int timeout_ms) override;
void wake() override;
std::size_t watched() const override { return callbacks_.size(); }
private:
int kq_ = -1;
int wake_pipe_[2] = {-1, -1};
std::unordered_map<int, Callback> callbacks_;
std::unordered_map<int, uint32_t> masks_;
};
} // namespace molo::runtime