Signals
Convenience interface to :mod:signals.
Attributes
| Attribute | Type | Description |
|---|---|---|
| ignored | int = _signal.SIG_IGN | Constant value representing the signal ignore action, used to disable the default behavior for a specific signal. |
| default | int = _signal.SIG_DFL | Constant 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
| Name | Type | Description |
|---|---|---|
| seconds | int | The number of seconds to wait before the alarm signal is triggered. |
Returns
| Type | Description |
|---|---|
int | The 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
| Type | Description |
|---|---|
int | The 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
| Name | Type | Description |
|---|---|---|
| name | str | The uppercase name of the signal to check for platform support. |
Returns
| Type | Description |
|---|---|
bool | True 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
| Name | Type | Description |
|---|---|---|
| name | `str | int` |
Returns
| Type | Description |
|---|---|
int | The 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
| Name | Type | Description |
|---|---|---|
| signal_names | str | One 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
| Name | Type | Description |
|---|---|---|
| names | str | One 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
| Name | Type | Description |
|---|---|---|
| d | dict = null | An optional dictionary mapping signal names to their respective handlers. |
| sigmap | kwargs | Keyword arguments where keys are signal names and values are the handlers to install. |