Skip to content

SIGNAL_D

object SIGNAL_D adm/daemons/signal.c

Daemon providing a system-wide event notification system. Manages registration, dispatch, and cleanup of signal handlers (slots), and persists them across reboots via the swap daemon. Every function below rejects callers other than the simul_efun layer — register, emit, and unregister through the slot(), emit(), and unslot() simul_efuns.

inherits STD_DAEMON std/daemon/daemon.c
variable slots mapping
# publicnomask register_slot

Registers an object’s function to receive a specific signal. One slot per object per signal — a second registration overwrites the first. Rejected unless the caller is the simul_efun layer.

param sig string The signal identifier to register for
param ob object The object to receive the signal
param func string The function to call when the signal fires
returns int SIG_SLOT_OK on success, or a negative SIG_* error code
# publicnomask unregister_slot

Unregisters an object from a signal. Removes the signal entry entirely once its last handler is gone. Rejected unless the caller is the simul_efun layer.

param sig string The signal identifier to unregister from
param ob object The object to unregister
returns int SIG_SLOT_OK on success, or a negative SIG_* error code
# publicnomask dispatch_signal

Broadcasts a signal to every registered handler. Each call is wrapped in catch() — a failing handler is logged to the SIGNAL_ERROR log and never blocks the others. Fire-and-forget: no return value. Rejected unless the caller is the simul_efun layer.

param sig string The signal identifier to dispatch
param arg... mixed Arguments passed through to each handler
returns void
# privatenomask invalidate_slots

Prunes invalid slots — those whose object has been destructed or whose handler function no longer exists. Runs on startup, on every heartbeat (60s), and once more before shutdown.

returns void