Skip to main content

Signals

Convenience interface to :mod:signals.

Attributes​

AttributeTypeDescription
ignoredint = _signal.SIG_IGNConstant value representing the signal ignore action, used to disable the default behavior for a specific signal.
defaultint = _signal.SIG_DFLConstant value representing the system default signal handler, used to restore a signal's original behavior.

Methods​


arm_alarm()​

@classmethod
def arm_alarm(
seconds: int
) - > int

Sets a timer to deliver a SIGALRM signal after a specified number of seconds.

Parameters​

NameTypeDescription
secondsintThe number of seconds to wait before the alarm signal is triggered.

Returns​

TypeDescription
intThe number of seconds remaining from a previous alarm request.

reset_alarm()​

@classmethod
def reset_alarm() - > int

Cancels any previously set alarm timer by setting the alarm to zero seconds.

Returns​

TypeDescription
intThe number of seconds remaining from the canceled alarm.

supported()​

@classmethod
def supported(
name: str
) - > bool

Return true value if signal by name exists on this platform.

Parameters​

NameTypeDescription
namestrThe uppercase name of the signal to check for platform support.

Returns​

TypeDescription
boolTrue if the signal name is recognized and supported by the current operating system, False otherwise.

signum()​

@classmethod
def signum(
name: str|int
) - > int

Get signal number by name.

Parameters​

NameTypeDescription
name`strint`

Returns​

TypeDescription
intThe integer constant associated with the specified signal name.

reset()​

@classmethod
def reset(
signal_names: str
)

Reset signals to the default signal handler.

Does nothing if the platform has no support for signals, or the specified signal in particular.

Parameters​

NameTypeDescription
signal_namesstrOne or more signal names to be restored to their default system behavior.

ignore()​

@classmethod
def ignore(
names: str
)

Ignore signal using :const:SIG_IGN.

Does nothing if the platform has no support for signals, or the specified signal in particular.

Parameters​

NameTypeDescription
namesstrOne or more signal names that should be ignored by the process.

update()​

@classmethod
def update(
_d_: dict = null,
sigmap: kwargs
)

Set signal handlers from a mapping.

Parameters​

NameTypeDescription
ddict = nullAn optional dictionary mapping signal names to their respective handlers.
sigmapkwargsKeyword arguments where keys are signal names and values are the handlers to install.