jaxvacua.util.exit_after

Contents

jaxvacua.util.exit_after#

exit_after(s)#

Decorator factory: wrap a function to abort if its execution exceeds s seconds. Internally arms a threading.Timer that calls quit_function() to interrupt the main thread on expiry.

Parameters:

s (int) – Timeout in seconds.

Returns:

Callable – A decorator.

Return type:

Callable

Example

@exit_after(5)
def slow():
    ...