- monitor(watched, observer, msg): registration lives on the watched actor's home thread (kind-7 envelope cross-shard); actor_die walks the list; already-dead fires NOW; the notice msg moves; a full observer's notice drops with a stderr line (no fiber to trap) - time.after(ms, addr, msg): per-shard timer list riding the deadline machinery (uring tick min + epoll timeout both include timers; fired from the same sweep); ms <= 0 delivers now; NO cancel — the generation-counter idiom is pinned by run/timer-generation - runtime_notify: one runtime-sourced delivery path (notices, timers) — reserve-or-drop, cross-shard via kind-0 envelopes - compiler: monitor typed as a bespoke free fn (notice typed against the OBSERVER's mailbox — the three-argument deviation, disclosed); time.after as a stdlib row whose msg arg is EXEMPT from the module- call fresh-arg drop (it moves — the double-own bug the timer fixture caught); owner move slots for both - corpus: run/monitor-death (trap-death + already-dead notices), run/timer-delivery (armed + immediate), run/timer-generation - teardown drops undelivered notices and unfired timers; battery 13/13 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
36 lines
821 B
Text
36 lines
821 B
Text
use time
|
|
|
|
-- iteration 24 T4: actor death is OBSERVABLE. The observer names its own
|
|
-- notice message; the watched actor trapping uncaught (the runtime's
|
|
-- stderr line) delivers it. Monitoring an ALREADY dead actor fires
|
|
-- immediately. WO_SHARDS=1 (the runner) keeps the order deterministic.
|
|
class Note {
|
|
who: Text
|
|
}
|
|
|
|
class Watch {
|
|
pad: Int
|
|
fn receive(msg: Note) {
|
|
print("died: ${msg.who}");
|
|
}
|
|
}
|
|
|
|
class Boom {
|
|
pad: Int
|
|
fn receive(msg: Note) {
|
|
let z = len(msg.who) - len(msg.who);
|
|
let q = 1 / z;
|
|
}
|
|
}
|
|
|
|
fn main() -> Int {
|
|
let obs: actor Note = spawn Watch { pad: 0 };
|
|
let b: actor Note = spawn Boom { pad: 0 };
|
|
monitor(b, obs, Note { who: "boom" });
|
|
send(b, Note { who: "x" });
|
|
time.sleep(100);
|
|
monitor(b, obs, Note { who: "late" });
|
|
time.sleep(100);
|
|
print("done");
|
|
return 0;
|
|
}
|