Skip to main content

blockdetection

Context that raises an exception if process is blocking.

Uses ``SIGALRM`` to detect blocking functions.
def blockdetection(
timeout: int
) - > contextmanager

Context that raises an exception if process is blocking. Uses SIGALRM to detect blocking functions.

Parameters

NameTypeDescription
timeoutintThe number of seconds to wait before triggering a SIGALRM to interrupt a blocking process.

Returns

TypeDescription
contextmanagerA context manager that arms a signal-based alarm for the duration of the block.