On Tue Jun 21 18:07:44 2022 +0000, **** wrote:
Zebediah Figura replied on the mailing list: ``` On 6/18/22 14:21, Piotr Caban wrote:
+static DWORD WINAPI io_thread(void *arg) +{ + struct thread_pump *thread_pump = arg; + struct work_item *work_item; + UINT zero = 0; + HRESULT hr; + + TRACE("%p thread started.\n", thread_pump); + + while (1) + { + RtlWaitOnAddress((void *)&thread_pump->io_count, &zero, sizeof(zero), NULL); + AcquireSRWLockExclusive(&thread_pump->io_lock); + if (!thread_pump->io_count) + { + ReleaseSRWLockExclusive(&thread_pump->io_lock); + continue; + } This works, but it strikes me as simpler (and more idiomatic) just to use a condition variable. Any reason not to do that? Note also that "zero" can be static const.
I'll change the code to use condition variables.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/272#note_2718