On 11/17/21 2:52 AM, Paul Gofman wrote:
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, ×pec ); + } + 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.
EINTR isn't relevant here, yes.
Complaining louder on unexpected errors is more reasonable, although we're in much greater control here relative to e.g. the old implementation of condition variables. I don't feel a pressing need to send a patch, but I won't object to one...