Only call the function in separate thread when in the main loop
This commit is contained in:
parent
8a5a75e68f
commit
3309489c24
1 changed files with 3 additions and 1 deletions
|
@ -27,7 +27,9 @@ class ThreadPool:
|
|||
return func
|
||||
|
||||
def wrapper(*args, **kwargs):
|
||||
res = self.pool.apply(func, args, kwargs)
|
||||
if not isMainThread(): # Call directly if not in main thread
|
||||
return func(*args, **kwargs)
|
||||
res = self.apply(func, args, kwargs)
|
||||
return res
|
||||
|
||||
return wrapper
|
||||
|
|
Loading…
Reference in a new issue