KronkNet 1.0
Loading...
Searching...
No Matches
poller.h
1/*
2** FREE PROJECT, 2026
3** KRONKNET
4** File description:
5** Wait for events on many sockets, the same way on every platform.
6*/
7#ifndef KRONKNET_PLATFORM_POLLER_H
8 #define KRONKNET_PLATFORM_POLLER_H
9 // NOTE: Who uses the poller gets the KN_POLL* flags too
10 #include "socket.h" // IWYU pragma: export
11 #include <stdint.h>
12
14
21typedef struct kronknet_poller_s knPoller;
22
24
28typedef struct kronknet_poll_event_s {
29
30 uint32_t events;
31 void *ptr;
32
33} knPollEvent;
34
36
42knPoller *knPoller_create(void);
43
45
49void knPoller_destroy(knPoller *poller);
50
52
63int knPoller_add(knPoller *poller, knSocket fd, void *ptr, uint32_t events);
64int knPoller_modify(knPoller *poller, knSocket fd, void *ptr, uint32_t events);
65
67
73int knPoller_remove(knPoller *poller, knSocket fd);
74
76
87int knPoller_wait(knPoller *poller, knPollEvent *events, int max, int timeoutMs);
88
89#endif /* KRONKNET_PLATFORM_POLLER_H */
What knPoller_wait reports for one socket.
Definition poller.h:28
uint32_t events
What happened (KN_POLL*).
Definition poller.h:30
void * ptr
The pointer given with the socket.
Definition poller.h:31
Definition poller.c:15