Expand description
Guest mailbox integration: exposes host-side wakers to guest tasks.
Safety: the mailbox views raw Wasm linear memory as a trio of shared
AtomicU32 slots (flag, tail, ring[..]). The guest owns the memory
allocation but must treat the region as host-only: only the host may
mutate the indices, while guests read them using matching atomic orderings.
The memory outlives the mailbox because we leak the structure via
create_guest_mailbox; use one Wasmtime store per guest instance to avoid
aliasing. The offsets match the layout emitted by selium-guest:
struct Mailbox {
head: u32,
flag: AtomicU32,
capacity: u32,
tail: AtomicU32,
ring: [AtomicU32; CAP]
}enqueue uses relaxed ordering for the per-slot write, release when
signalling writers, and AcqRel on the tail counter so concurrent wakers are
totally ordered.
Structs§
- Guest
Mailbox - Mailbox exposing guest task IDs to the host async scheduler.
Functions§
- create_
guest_ ⚠mailbox - Safety