sync-mbox
Mailbox
Mailbox is a bounded, addressed message queue: one process sends into it, another consumes from it in FIFO order. Unlike CSP channels (anonymous rendezvous) or Linda (addressed by content), mailboxes are owned by a specific recipient and provide natural backpressure when full.
Mailboxes are standard in RTOSes (FreeRTOS, Zephyr) and language-level communication in Erlang/Elixir.
Example
This example shows mailbox send/receive with backpressure:
// compile: (pseudocode for typical RTOS API) // description: bounded mailbox prevents unbounded queue growth mbox_t inbox; mbox_create(&inbox, 16); // bounded to 16 messages void producer(void) { struct msg m = {42}; mbox_send(&inbox, &m); // blocks if mailbox full (backpressure) } void consumer(void) { struct msg m; mbox_recv(&inbox, &m); // blocks if mailbox empty }
sync-mbox.md · Last modified: by 127.0.0.1
