From: Stefan Sperling Subject: Re: tog: basic diff regress To: Mark Jamsek Cc: Game of Trees Date: Sat, 15 Apr 2023 17:23:52 +0200 On Sat, Apr 15, 2023 at 09:46:51PM +1000, Mark Jamsek wrote: > The below diff (which applies on top of main) adds a new WAIT_FOR_UI > instruction to the test harness, and a basic blame regress test that > demonstrates its use. When the instruction is received a flag is set, > which delays processing further instructions till it is unset, which, in > this case, is when the blame process is complete. This can easily be > extrapolated to future cases that require waiting till the UI has been > drawn. Looks fine. ok I would have expected pthread_cond_wait() to be involved while waiting. This would require more than one WAIT-style instruction to identify which condition the main thread should for. I guess the way you implemented this we will essentially busy-loop in the view input handlers until the variable is flipped by the other thread? That is a bit less elegant than waiting via pthread APIs. But of course if it works it can be good enough for tests. And in any case it is better than sleeping for some fixed amount of time.