ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
worker.h
Go to the documentation of this file.
1#pragma once
2
3#include "udp.h"
4#include <libplatform/mutex.h>
5
6/* Private endpoint worker. Run at most one worker for an endpoint. The endpoint, lane mutex, and callback context
7 * remain owned by the caller and outlive the stopped worker. An accept callback
8 * runs under the lane lock and must not block or call locking adapter methods.
9 * A failure callback runs without that lock and must detach and remove the
10 * failed connection before returning true; false stops the worker. */
13
15/* Variant: failure callback runs on the held endpoint lane and must not lock it. */
17/* Thread-safe while the worker and endpoint remain alive. */
18void quic_worker_wake(void *worker);
19/* Stops and joins the worker, then frees it. Returns its terminal error. */
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
struct quic_connection quic_connection_t
static bool size_t gotel_query_t * out
Definition queries.h:10
For acip quic worker, this is the live record that ties endpoint, lane, failure, context together....
Definition worker.c:13
void * context
Definition worker.c:17
quic_worker_failure_fn failure
Definition worker.c:16
mutex_t * lane
Definition worker.c:15
quic_udp_endpoint_t * endpoint
Definition worker.c:14
struct quic_udp_endpoint quic_udp_endpoint_t
Definition udp.h:14
struct quic_worker quic_worker_t
Definition worker.h:11
asciichat_error_t quic_worker_start_locked_failure(quic_udp_endpoint_t *endpoint, mutex_t *lane, quic_worker_failure_fn failure, void *context, quic_worker_t **out)
Definition worker.c:105
asciichat_error_t quic_worker_start(quic_udp_endpoint_t *endpoint, mutex_t *lane, quic_worker_failure_fn failure, void *context, quic_worker_t **out)
Definition worker.c:101
void quic_worker_wake(void *worker)
Definition worker.c:109
asciichat_error_t quic_worker_stop(quic_worker_t **worker)
Definition worker.c:115
bool(* quic_worker_failure_fn)(quic_connection_t *, asciichat_error_t, void *)
Definition worker.h:12