Name

SPVM::Sys::Signal - Signals

Description

The Sys::Signal class of SPVM has methods to manipulate signals.

Usage

use Sys::Signal;
use Sys::Signal::Constant as SIGNAL;

Sys::Signal->kill($process_id, SIGNAL->SIGINT);

Sys::Signal->signal(SIGNAL->SIGTERM, Sys::Signal->SIG_IGN);

Class Methods

raise

static method raise : int ($sig : int)

Calls the raise function and returns its return value.

See Sys::Signal::Constant about constant values given to $sig.

Exceptions:

If the raise function failed, an exception is thrown with eval_error_id set to the basic type ID of the Error::System class.

kill

static method kill : int ($pid : int, $sig : int)

Calls the kill function and returns its return value.

See Sys::Signal::Constant about constant values given to $sig.

Exceptions:

If the kill function failed, an exception is thrown with eval_error_id set to the basic type ID of the Error::System class.

In Windows the following excetpion is thrown. kill is not supported in this system(defined(_WIN32)).

alarm

static method alarm : int ($seconds : int)

Calls the alarm function and returns its return value.

Exceptions:

If the alarm function failed, an exception is thrown with eval_error_id set to the basic type ID of the Error::System class.

In Windows the following excetpion is thrown. alarm is not supported in this system(defined(_WIN32)).

ualarm

static method ualarm : int ($usecs : int, $interval : int)

Calls the ualarm function and returns its return value.

Exceptions:

In Windows the following excetpion is thrown. ualarm is not supported in this system(defined(_WIN32)).

signal

static method signal : Sys::Signal::Handler ($signum : int, $handler : Sys::Signal::Handler);

Calls signal function and creates a signal handler object with its pointer set to the function's return value, and returns it.

$handler can be "SIG_DFL" and "SIG_IGN".

See Sys::Signal::Constant about constant values given to $sig.

Exceptions:

$handler must be defined. Otherwise an exception is thrown.

If the signal function failed, an exception is thrown with eval_error_id set to the basic type ID of the Error::System class.

SIG_DFL

static method SIG_DFL : Sys::Signal::Handler ();

Creates a new signal handler that represents SIG_DFL.

SIG_IGN

static method SIG_IGN : Sys::Signal::Handler ();

Creates a new signal handler that represents SIG_IGN.

SIG_GO

static method SIG_GO : Sys::Signal::Handler ();

Creates a new signal handler that represents the signal handler for Go::OS::Signal.

Do not use this signal handler because this signal handler is prepared to implement the Go::OS::Signal class.

SET_SIG_GO_WRITE_FD

static method SET_SIG_GO_WRITE_FD : void ($fd : int);

Set a write file descriptor for Go::OS::Signal.

Do not use this method because this method is prepared to implement the Go::OS::Signal class.

See Also

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License