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.