mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
t/hand: Document and fix cond var loop
This commit is contained in:
parent
2300e4fa57
commit
b41addbbe7
|
@ -61,16 +61,18 @@ ht_async_mainloop(void *ptr)
|
||||||
|
|
||||||
os_thread_helper_lock(&hta->mainloop);
|
os_thread_helper_lock(&hta->mainloop);
|
||||||
|
|
||||||
while (hta->mainloop.running) {
|
while (os_thread_helper_is_running_locked(&hta->mainloop)) {
|
||||||
|
|
||||||
// No new frame, wait.
|
// No new frame, wait.
|
||||||
if (hta->frames[0] == NULL && hta->frames[1] == NULL) {
|
if (hta->frames[0] == NULL && hta->frames[1] == NULL) {
|
||||||
os_thread_helper_wait_locked(&hta->mainloop);
|
os_thread_helper_wait_locked(&hta->mainloop);
|
||||||
}
|
|
||||||
|
|
||||||
// In this case, we were woken up because Monado is exiting and we need to exit too
|
/*
|
||||||
if (!hta->mainloop.running) {
|
* Loop back to the top to check if we should stop,
|
||||||
break;
|
* also handles spurious wakeups by re-checking the
|
||||||
|
* condition in the if case. Essentially two loops.
|
||||||
|
*/
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
os_thread_helper_unlock(&hta->mainloop);
|
os_thread_helper_unlock(&hta->mainloop);
|
||||||
|
|
Loading…
Reference in a new issue