Dont sleep unnecessarily in the common case

This commit is contained in:
Kovid Goyal 2017-08-02 20:44:50 +05:30
parent 674c3e98f8
commit 7102fcdf7c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -289,13 +289,13 @@ def linux_native_dialog(name):
loop = QEventLoop(window)
def r():
while not loop.isRunning():
time.sleep(0.001) # yield so that loop starts
try:
ret[0] = func(window, *args, **kwargs)
except:
ret[1] = sys.exc_info()
sys.exc_clear()
while not loop.isRunning():
time.sleep(0.001) # yield so that loop starts
loop.quit()
t = Thread(name='FileDialogHelper', target=r)
t.daemon = True