|
cwist
Modern C web framework with libttak runtime
|
Readiness multiplexer (io_uring / epoll / kqueue) driving CWIST's synchronous callback model. More...
#include <cwist/sys/io/reactor.h>#include "reactor_rx.h"#include "async_debug.h"#include <cwist/core/mem/alloc.h>#include <cwist/sys/app/shutdown.h>#include <unistd.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <errno.h>#include <poll.h>#include <pthread.h>#include <stdatomic.h>#include <fcntl.h>#include <limits.h>#include <time.h>
Go to the source code of this file.
Macros | |
| #define | _POSIX_C_SOURCE 200809L |
| #define | REACTOR_CHUNK_EVENTS 512 |
| #define | REACTOR_IDLE_WAIT_NS 100000000ull |
Typedefs | |
| typedef struct reactor_slot_chunk | reactor_slot_chunk_t |
Readiness multiplexer (io_uring / epoll / kqueue) driving CWIST's synchronous callback model.
Design note - why readiness notification + synchronous completion is kept:
Definition in file reactor.c.
| typedef struct reactor_slot_chunk reactor_slot_chunk_t |
| bool cwist_reactor_add | ( | cwist_reactor_t * | reactor, |
| int | fd, | ||
| cwist_reactor_cb_t | cb, | ||
| const void * | payload, | ||
| size_t | payload_size | ||
| ) |
Definition at line 1357 of file reactor.c.
References cap.
Referenced by cwist_async_server_loop(), cwist_reactor_create(), and cwist_websocket_async_attach_ex().
| bool cwist_reactor_add_out | ( | cwist_reactor_t * | reactor, |
| int | fd, | ||
| cwist_reactor_cb_t | cb, | ||
| const void * | payload, | ||
| size_t | payload_size | ||
| ) |
Definition at line 1362 of file reactor.c.
References cap.
Referenced by cwist_http_async_send_response(), cwist_http_coalesce_flush(), cwist_http_send_response_async(), and cwist_http_send_response_coalesced().
| cwist_reactor_t * cwist_reactor_create | ( | void | ) |
Definition at line 1006 of file reactor.c.
References cap, cwist_alloc(), cwist_free(), and cwist_reactor_add().
Referenced by cwist_async_server_loop(), cwist_http_pool_init_mode(), and cwist_webrtc_ctx_new().
| bool cwist_reactor_del | ( | cwist_reactor_t * | reactor, |
| int | fd | ||
| ) |
| void cwist_reactor_destroy | ( | cwist_reactor_t * | reactor | ) |
Definition at line 1116 of file reactor.c.
References cap, and cwist_free().
Referenced by cwist_async_server_loop(), cwist_http_pool_destroy(), cwist_webrtc_ctx_free(), and cwist_webrtc_ctx_new().
| bool cwist_reactor_mod | ( | cwist_reactor_t * | reactor, |
| int | fd, | ||
| cwist_reactor_cb_t | cb, | ||
| const void * | payload, | ||
| size_t | payload_size | ||
| ) |
| bool cwist_reactor_post | ( | cwist_reactor_t * | r, |
| cwist_reactor_post_t * | node | ||
| ) |
Definition at line 833 of file reactor.c.
References cap, cwist_reactor_post::cb, head, and cwist_reactor_post::next.
| void cwist_reactor_run | ( | cwist_reactor_t * | reactor | ) |
Definition at line 1579 of file reactor.c.
References cap, cwist_free(), and head.
Referenced by cwist_async_server_loop().
| void cwist_reactor_stop | ( | cwist_reactor_t * | reactor | ) |
| bool cwist_reactor_timer_arm | ( | cwist_reactor_t * | r, |
| cwist_reactor_timer_t * | timer, | ||
| uint64_t | delay_us | ||
| ) |
Definition at line 937 of file reactor.c.
References cap, cwist_reactor_timer::cb, cwist_alloc(), cwist_free(), cwist_reactor_timer::deadline_ns, and cwist_reactor_timer::heap_slot.
| bool cwist_reactor_timer_armed | ( | const cwist_reactor_timer_t * | timer | ) |
Definition at line 961 of file reactor.c.
References cwist_reactor_timer::heap_slot.
| void cwist_reactor_timer_cancel | ( | cwist_reactor_t * | r, |
| cwist_reactor_timer_t * | timer | ||
| ) |
Definition at line 956 of file reactor.c.
References cwist_reactor_timer::heap_slot.
| void cwist_reactor_timer_init | ( | cwist_reactor_timer_t * | timer, |
| void(*)(void *ctx) | cb, | ||
| void * | ctx | ||
| ) |
Definition at line 929 of file reactor.c.
References cwist_reactor_timer::cb, cwist_reactor_timer::ctx, cwist_reactor_timer::deadline_ns, and cwist_reactor_timer::heap_slot.