Signal – signal handle

class uv.Signal(loop=None, callback=None)[source]

Signal handles implement Unix style signal handling on a per-event loop bases. Reception of the generic uv.Signals is emulated on Windows. Watchers for other signals can be successfully created, but these signals are never received.

Note

On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL pthreads library to manage threads. Installing watchers for those signals will lead to unpredictable behavior and is strongly discouraged. Future versions of libuv may simply reject them.

Raises:

uv.UVError – error during the initialization of the handle

Parameters:
  • loop (Loop) – event loop which should be used for the handle
  • callback ((uv.Signal, int) -> None) – callback which should be called on signal delivery
callback

Callback which should be called on signal delivery.

callback(Signal-Handle, Signal-Number)
Readonly:False
Type:(uv.Signal, int) -> None
signum

Signal being monitored by this handle.

Raises:uv.HandleClosedError – handle has already been closed or is closing
Readonly:True
Return type:int
start(signum, callback=None)[source]

Starts the handle.

Raises:
Parameters:
  • signum (int) – signal number which should be monitored
  • callback ((uv.Signal) -> None) – callback which should be called on signal delivery
stop()[source]

Stops the handle, the callback will no longer be called.

Raises:uv.UVError – error while stopping the handle
class uv.Signals[source]

Generic signals enumeration.

SIGINT = None

Is normally delivered when the user presses CTRL+C. However it is not generated when terminal is in raw mode.

Type:int
SIGBREAK = None

Is delivered when the user presses CTRL+BREAK.

Type:int
SIGHUP = None

Is generated when the user closes the console window. After that the OS might terminate the program after a few seconds.

Type:int
SIGWINCH = None

Is generated when the console window has been resized. On Windows libuv emulates SIGWINCH when the program uses a uv.TTY handle to write to the console. It may not always be delivered in a timely manner, because libuv will only detect changes when the cursor is being moved. When a readable uv.TTY handle is used in raw mode, resizing the console buffer will also trigger SIGWINCH.

Type:int