ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
ring.h File Reference

Shared single-producer / single-consumer byte-ring primitive. More...

#include <atomic>
#include <stddef.h>
#include <stdint.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  pc_atomic< T >
 

Detailed Description

Shared single-producer / single-consumer byte-ring primitive.

The one implementation of the receive-ring drain math, used by BOTH transports: the server (pc_conn_* in tcp.h, over conn_pool slots) and the outbound client (pc_client_* over its pool). Sharing it is deliberate - it keeps the ring invariants in a single place so a consumer in any layer drains identically and cannot reimplement (and subtly break) the wrap/ordering by hand.

Ownership rule: exactly one producer advances head, exactly one consumer advances tail; indices are pc_atomic so a producer's buffer writes are visible before the consumer observes the advanced index (acquire/release), correct across the tcpip_thread <-> worker/caller boundary on either core. No locks, no RMW.

Definition in file ring.h.