Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.77 KB

index.rst

File metadata and controls

64 lines (47 loc) · 1.77 KB

cysignals

This is the documentation for cysignals, a package to deal with interrupts and signal handling in Cython code.

When writing Cython code, special care must be taken to ensure that the code can be interrupted with CTRL-C. Since Cython optimizes for speed, Cython normally does not check for interrupts. For example, code like the following cannot be interrupted in Cython:

while True:
    pass

While this is running, pressing CTRL-C has no effect. The only way out is to kill the Python process. On certain systems, you can still quit Python by typing CTRL-\ (sending a Quit signal) instead of CTRL-C. The package cysignals provides functionality to deal with this, see section_interrupt.

Besides this, cysignals also provides Python functions/classes to deal with signals. These are not directly related to interrupts in Cython, but provide some supporting functionality beyond what Python provides, see index_python.

Interrupt/Signal Handling

Dealing with interrupts and other signals using sig_check and sig_on:

interrupt signals sigadvanced crash

Error handling

Defining error callbacks for external libraries using sig_error:

sigerror

Signal-related interfaces for Python code

cysignals provides further support for system calls related to signals:

pysignals pselect