mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont sleep unnecessarily in the common case
This commit is contained in:
parent
674c3e98f8
commit
7102fcdf7c
@ -289,13 +289,13 @@ def linux_native_dialog(name):
|
|||||||
loop = QEventLoop(window)
|
loop = QEventLoop(window)
|
||||||
|
|
||||||
def r():
|
def r():
|
||||||
while not loop.isRunning():
|
|
||||||
time.sleep(0.001) # yield so that loop starts
|
|
||||||
try:
|
try:
|
||||||
ret[0] = func(window, *args, **kwargs)
|
ret[0] = func(window, *args, **kwargs)
|
||||||
except:
|
except:
|
||||||
ret[1] = sys.exc_info()
|
ret[1] = sys.exc_info()
|
||||||
sys.exc_clear()
|
sys.exc_clear()
|
||||||
|
while not loop.isRunning():
|
||||||
|
time.sleep(0.001) # yield so that loop starts
|
||||||
loop.quit()
|
loop.quit()
|
||||||
t = Thread(name='FileDialogHelper', target=r)
|
t = Thread(name='FileDialogHelper', target=r)
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user