Scheduler-context wait queue with explicit wake-all and wake-one operations. The Signal wrapper stores no persistent boolean state and remembers no prior wake.
Signal model
Signal
Methods
INIT
(--) Performs no operation.wake
(--) Wakes every currently waiting context.wakeOne
(--) Wakes the oldest currently waiting context.Waiting and cancellation semantics
Examples
FIFO wakeOne order
"String" use
"control" use
"sync/Signal" use
"sync/sync" use
{} Int32 {} [
signal: Signal;
one: {signal: @signal; CALL: [
@signal.wait
("one" LF) printList
];} () spawn;
two: {signal: @signal; CALL: [
@signal.wait
("two" LF) printList
];} () spawn;
yield
@signal.wakeOne
yield
@signal.wakeOne
@one.wait
@two.wait
0
] "main" exportFunction
Expected Output
one
two
Wake is not remembered
"String" use
"control" use
"sync/Signal" use
"sync/sync" use
{} Int32 {} [
signal: Signal;
@signal.wake
context: {signal: @signal; CALL: [
@signal.wait
("released" LF) printList
];} () spawn;
yield
context.done? [
("done" LF) printList
] [
("waiting" LF) printList
] if
@signal.wakeOne
@context.wait
0
] "main" exportFunction
Expected Output
waiting
released
See also
- sync/Event: Persistent event state with clear, set, wait, wake, and wakeOne.
- sync/Context: Spawned context handle with waiting, output retrieval, and cancellation.
- sync/sync: Cross-platform scheduling, sleep, time, IPv4 formatting, and TCP helpers.