|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
Thread-safe packet queue for producer-consumer communication. More...
#include <lib/network/packet_queue.h>
Public Member Functions | |
| _Atomic (packet_node_t *) head | |
| Front of queue (dequeue from here) - atomic for lock-free access. | |
| _Atomic (packet_node_t *) tail | |
| Back of queue (enqueue here) - atomic for lock-free access. | |
Data Fields | |
| _Atomic size_t | count |
| Number of packets currently in queue - atomic for lock-free access. | |
| size_t | max_size |
| Maximum queue size (0 = unlimited) | |
| _Atomic size_t | bytes_queued |
| Total bytes of data queued (for monitoring) - atomic for lock-free access. | |
| node_pool_t * | node_pool |
| Optional memory pool for nodes (NULL = use malloc/free) | |
| buffer_pool_t * | buffer_pool |
| Optional memory pool for data buffers (NULL = use malloc/free) | |
| _Atomic uint64_t | packets_enqueued |
| Total packets enqueued (statistics) - atomic for lock-free access. | |
| _Atomic uint64_t | packets_dequeued |
| Total packets dequeued (statistics) - atomic for lock-free access. | |
| _Atomic uint64_t | packets_dropped |
| Total packets dropped due to queue full (statistics) - atomic for lock-free access. | |
| _Atomic bool | shutdown |
| Shutdown flag (true = dequeue returns NULL) - atomic for lock-free access. | |
Thread-safe packet queue for producer-consumer communication.
Implements a FIFO queue with blocking operations for efficient thread coordination. Producers (audio mixer, video render) enqueue packets asynchronously, while consumers (per-client send threads) dequeue packets for transmission.
QUEUE OPERATIONS:
MEMORY POOLS:
SYNCHRONIZATION:
Definition at line 213 of file packet_queue.h.
| packet_queue_t::_Atomic | ( | packet_node_t * | ) |
Back of queue (enqueue here) - atomic for lock-free access.