Skip to content

nexus.EventQueue

nexus · scripts/+nexus/EventQueue.m

: q = nexus.EventQueue ()

Thread-safe event queue for producer/consumer hand-off.

MATLAB R2026a has no public nexus.EventQueue; the reference behaviour for this Nexus API is the producer/consumer pattern MATLAB documents with parallel.pool.PollableDataQueue (send/poll) and timer / parfeval callbacks. This class exposes the backlog names post/wait:

q = nexus.EventQueue;
post (q, 42);
data = wait (q);

post (q, data) enqueues data (FIFO). data = wait (q) blocks until an item is available. data = wait (q, timeout) waits up to timeout seconds (Inf = forever; 0 = non-blocking). [data, ok] = wait (__) also returns whether an item was received.

Timer callbacks that post while another call is in wait are delivered because wait runs the timer dispatch hook. Workers may post through the same file side-channel used by parallel.pool.DataQueue when the queue is passed into parfeval.