Web/reactor/epoll.h
2025-09-15 12:57:54 -05:00

26 lines
698 B
C

#ifndef EPOLL_H
#define EPOLL_H
#include <sys/epoll.h>
#include <stdint.h>
#include <stdbool.h>
typedef struct runtime runtime_t;
typedef void (*handler_fn)(runtime_t *rt, int fd, uint32_t events, void *data);
// Core runtime functions
runtime_t* runtime_new(int max_events);
void runtime_free(runtime_t *rt);
int runtime_run(runtime_t *rt);
void runtime_stop(runtime_t *rt);
// File descriptor management
int runtime_add(runtime_t *rt, int fd, uint32_t events, handler_fn handler, void *data);
int runtime_mod(runtime_t *rt, int fd, uint32_t events, handler_fn handler, void *data);
int runtime_del(runtime_t *rt, int fd);
// Utility functions
int set_nonblocking(int fd);
#endif // EPOLL_H