Signals over IPC, one-shot timers, and the service harness (M17.4)
Signals are statements delivered as coalescing notifications to the endpoint a process nominates with signal_bind — never a hijacked stack, never a question (liveness is the zero-length ping the harness answers). process_signal is supervisor-or-self gated, like kill; unbound targets accumulate a pending mask delivered on bind. timer_bind is the missing timed wait: a one-shot deadline landing in the same replyWait as everything else — what stop(), hello deadlines, and restart backoff are built from. runtime.service.run folds requests, signals, and notifications into callbacks; the VFS conversion deletes its hand-rolled loop and gains the whole lifecycle contract. The signals scenario drives ping, reload, terminate->exited, the timer, and the deaf-child deadline->killed path from ring 3. docs/process-lifecycle.md increments 1-4 are now as-built.
This commit is contained in:
@@ -94,6 +94,15 @@ pub fn send(h: Handle, message: []const u8) bool {
|
||||
/// GSI. See `isNotification`.
|
||||
pub const notify_badge_bit: u64 = abi.notify_badge_bit;
|
||||
|
||||
/// Set alongside `notify_badge_bit` when the notification is a **signal** — the
|
||||
/// lifecycle vocabulary of docs/process-lifecycle.md, delivered to the endpoint
|
||||
/// nominated with `process.bindSignals`. Decode with `process.signalsFrom`.
|
||||
pub const notify_signal_bit: u64 = abi.notify_signal_bit;
|
||||
|
||||
/// Set alongside `notify_badge_bit` when the notification is a **one-shot timer**
|
||||
/// landing (`system.timerOnce`).
|
||||
pub const notify_timer_bit: u64 = abi.notify_timer_bit;
|
||||
|
||||
/// Set alongside `notify_badge_bit` when the notification is a **child-exit
|
||||
/// notice** — a process this one spawned (with an exit endpoint) has ended —
|
||||
/// rather than a device interrupt. The low bits carry the child's process id.
|
||||
@@ -133,6 +142,17 @@ pub const Received = struct {
|
||||
}
|
||||
|
||||
/// The task id of whoever posted a buffered message, meaningful only when
|
||||
/// Whether this arrival is a signal notification — decode the set with
|
||||
/// `process.signalsFrom(badge)`.
|
||||
pub fn isSignal(self: Received) bool {
|
||||
return self.isNotification() and self.badge & notify_signal_bit != 0;
|
||||
}
|
||||
|
||||
/// Whether this arrival is a one-shot timer landing (`system.timerOnce`).
|
||||
pub fn isTimer(self: Received) bool {
|
||||
return self.isNotification() and self.badge & notify_timer_bit != 0;
|
||||
}
|
||||
|
||||
/// `isMessage`. (The badge's low bits, with the three high marker bits masked off.)
|
||||
pub fn senderTaskId(self: Received) u32 {
|
||||
return @intCast(self.badge & ~(notify_badge_bit | notify_exit_bit | notify_message_bit));
|
||||
|
||||
Reference in New Issue
Block a user