Force cleanup of thread if function completes in time. On python2 this forces the thread to be cleaned up right-away, on python3 it would get cleaned up during the next garbage-collect cycle. In python2 it may take several rounds.
This commit is contained in:
parent
3dcf6f921e
commit
5a6187122d
@ -84,6 +84,10 @@ def func_timeout(timeout, func, args=(), kwargs=None):
|
||||
thread._stopThread(stopException)
|
||||
thread.join(min(.1, timeout / 50.0))
|
||||
raise FunctionTimedOut('', timeout, func, args, kwargs)
|
||||
else:
|
||||
# We can still cleanup the thread here..
|
||||
# Still give a timeout... just... cuz..
|
||||
thread.join(.5)
|
||||
|
||||
if exception:
|
||||
raise exception[0]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user