mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
test-runner: only remove GLib timeout if it exists
There was a race condition here where the GLib timeout could have fired but the test function returned successfully prior to the end of the while loop. This would end up causing source_remove to print a warning that the source did not exist. Instead check if the timeout fired prior to removing it.
This commit is contained in:
parent
cb4f1d2a99
commit
7b98a6ed9c
@ -751,10 +751,12 @@ class Namespace:
|
|||||||
try:
|
try:
|
||||||
ret = func(*args)
|
ret = func(*args)
|
||||||
if ret:
|
if ret:
|
||||||
GLib.source_remove(timeout)
|
if not done.value:
|
||||||
|
GLib.source_remove(timeout)
|
||||||
return ret
|
return ret
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
GLib.source_remove(timeout)
|
if not done.value:
|
||||||
|
GLib.source_remove(timeout)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
|
Loading…
Reference in New Issue
Block a user