From 36b7d6f266c95d7e08a9ce5ddb6b5588eac9fcd6 Mon Sep 17 00:00:00 2001 From: Tim Savannah Date: Sat, 20 May 2017 16:21:43 -0400 Subject: [PATCH] Decrease thread join time. Because it is a daemon thread it will get closed automatically on garbage collect, just need to initate a join at all. --- func_timeout/dafunc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/func_timeout/dafunc.py b/func_timeout/dafunc.py index fff9cfa..5689061 100644 --- a/func_timeout/dafunc.py +++ b/func_timeout/dafunc.py @@ -80,7 +80,7 @@ def func_timeout(timeout, func, args=(), kwargs=None): isStopped = True stopException = FunctionTimedOut thread._stopThread(stopException) - thread.join(.1) + thread.join(min(.1, timeout / 50.0)) raise FunctionTimedOut('', timeout, func, args, kwargs) if exception: