[PATCH v3 3/9] d3dx10: Add ID3DX10ThreadPump:AddWorkItem implementation.

Zebediah Figura zfigura at codeweavers.com
Tue Jun 21 13:07:33 CDT 2022


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.



More information about the wine-devel mailing list