[PATCH 3/4] ntdll: Implement thread-ID alerts using futexes if possible.

Paul Gofman pgofman at codeweavers.com
Wed Nov 17 02:52:06 CST 2021


On 11/17/21 11:48, Paul Gofman wrote:
> On 11/17/21 06:50, Zebediah Figura wrote:
>> +        while (!InterlockedExchange( futex, 0 ))
>> +        {
>> +            if (timeout)
>> +            {
>> +                LONGLONG timeleft = update_timeout( end );
>> +                struct timespec timespec;
>> +
>> +                timespec.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC;
>> +                timespec.tv_nsec = (timeleft % TICKSPERSEC) * 100;
>> +                ret = futex_wait( futex, 0, &timespec );
>> +            }
>> +            else
>> +                ret = futex_wait( futex, 0, NULL );
>> +
>> +            if (ret == -1 && errno == ETIMEDOUT) return STATUS_TIMEOUT;
>> +        }
>> +        return STATUS_ALERTED;
>> +    }
>> +#endif
>> +
> Do you think it is possible or makes sense to handle EINTR and retry 
> wait to avoid delivering spurious wakeups to the application in this 
> case? We have a lot of SIGUSR1 for Wine async I/O handling. Also, 
> maybe it would be interesting to log unexpected errors? Not that 
> anything besides EINTR should ever happen as I understand, but 
> sometimes unexpected errors happen and may indicate a real issue and 
> that happened once in the past with the current upstream in process sync.
>
Eh, please disregard the first part about EINTR, that doesn't relate to 
the present code.




More information about the wine-devel mailing list