Name

SPVM::Go::OS::Signal - Signal Manipulation

Description

Go::OS::Signal class in SPVM provides a way to handle OS signals using channels.

Usage

use Go::OS::Signal;
use Sys::Signal::Constant as SIGNAL_C;
use Sys;

my $ch = Go->make(1);

Go::OS::Signal->notify($ch, SIGNAL_C->SIGTERM);

Sys->kill(SIGNAL_C->SIGTERM, Sys->process_id);

my $signal = $ch->read;

Class Methods

ignore

static method ignore : void ($signal : int);

Ignores the signal $signal.

See Sys::Signal::Constant about the values of signals.

notify

static method notify : void ($channel : Go::Channel, $signal : int);

Creates a goroutine to read the sent signal and write it to the $channel.

See Sys::Signal::Constant about the values of signals.

stop

static method stop : void ($channel : Go::Channel, $signal : int);

Stops the signal handling for the signal $signal and the channel $channel.

See Sys::Signal::Constant about the values of signals.

start_signal_handler

static method start_signal_handler : void ();

Deprecated. Will be removed.

stop_signal_handler

static method stop_signal_handler : void ();

Deprecated. Will be removed.

reset

static method reset : void ();

Resets all signal handlers and clears registered channels.

Copyright & License

Copyright (c) 2026 Yuki Kimoto

MIT License