On Fri Dec 9 06:37:55 2022 +0000, Rémi Bernon wrote:
Sorry, I missed it but I think this one is also inherently racy, as you can see. The handler being reset to NULL happens asynchronously, some time after the handler has been invoked (after the event is set). You cannot synchronize on this, and so this check will sometimes succeed and sometimes fail depending on whether the main thread resumes from the event wait before or after this happens. You can only remove the test (and you can reduce the wait timeout though it doesn't really matter).
No problem, thanks for pointing it out. I see, I guess in W.G.I this test is also controlled?
I removed the test.
Thanks for all the detailed feedback and explanations, I appreciate it. You're a great teacher.