KronkNet 1.0
Loading...
Searching...
No Matches
pool.h
1/*
2** FREE PROJECT, 2026
3** KRONKNET
4** File description:
5** Pool of the sockets the server waits on
6*/
7#ifndef KRONKNET_POOL_H
8 #define KRONKNET_POOL_H
9 #include <stddef.h>
10 #include <stdint.h>
11 #include "../../platform/poller.h"
12 #include <stdbool.h>
13
14typedef struct kronknet_connection_s knConnection;
15
17
26typedef struct kronknet_pool_s {
27
28 knPoller *poller;
29 knConnection **conns;
30 size_t size;
31 size_t count;
32
33} knPool;
34
35
36
38
48int knPool_registerFd(knPool *pool, knSocket fd, knConnection *conn, uint32_t events);
50
51
53
63int knPool_modifyFd(knPool *pool, knSocket fd, knConnection *conn, uint32_t events);
65
66
68
76int knPool_unregister(knPool *pool, knSocket fd);
78
79
81
89int knPool_unregisterAtIndex(knPool *pool, size_t index);
91
92
94
101int knPool_init(knPool *pool);
103
104
106
113void knPool_clear(knPool *pool);
115
116#endif /* KRONKNET_POOL_H */
Definition connection.h:27
Definition pool.h:26
knConnection ** conns
The connections.
Definition pool.h:29
knPoller * poller
The poller of the sockets.
Definition pool.h:28
size_t size
The capacity of the pool.
Definition pool.h:30
size_t count
The number of fds in the pool.
Definition pool.h:31