X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=decorator_utils.py;h=4615fec6f8960e0083ce48546ba9421c25243d42;hb=e46158e49121b8a955bb07b73f5bcf9928b79c90;hp=438d7f9ee1907146666c12f8d7e74eb46d56bd96;hpb=f3dbc7dc19ba5703f8f5aa9bf8af3c491b3510f6;p=python_utils.git diff --git a/decorator_utils.py b/decorator_utils.py index 438d7f9..4615fec 100644 --- a/decorator_utils.py +++ b/decorator_utils.py @@ -647,6 +647,13 @@ def timeout( main thread). When not using signals, timeout granularity will be rounded to the nearest 0.1s. + Beware that an @timeout on a function inside a module will be + evaluated at module load time and not when the wrapped function is + invoked. This can lead to problems when relying on the automatic + main thread detection code (use_signals=None, the default) since + the import probably happens on the main thread and the invocation + can happen on a different thread (which can't use signals). + Raises an exception when/if the timeout is reached. It is illegal to pass anything other than a function as the first