LIU Hao wrote:

> 在 2026-9-12 22:24, Kirill Makurin 写道:
>> Hello,
>>
> When I was getting more familiar with winpthreads' source code back in May, 
> wrappers `_pthread_wait_for_single_object` and 
> `_pthread_wait_for_multiple_objects ` caught my attention. They were added in 
> this commit[1].
>>
>> How bad is precision of `WaitForSingleObject` and `WaitForMultipleObjects `? 
>> They accept timeout in milliseconds; `SYSTEMTIME` supports millisecond 
>> resolution; `FILETIME` uses sub-microsecond resolution (if converted from 
>> `SYSTEMTIME`, sub-millisecond part is likely lost); so how bad can it be? I 
>> assume it may be the case for older Windows versions or old hardware?
>>
>> I'm simply curious and by no means I suggest that we remove them.
>
> By default the granularity is 15-16 milliseconds; so if you request one 
> millisecond, it usually takes
> 15-16 milliseconds, and intermittently up to 40 milliseconds.

Thanks for the information. It seems like it roughly matches precision of 
GetTickCount*, which according to this article[1], is 10-16ms.

> The granularity can be decreased with `timeBeginPeriod()`, down to one 
> millisecond.

- Kirill Makurin

[1] https://learn.microsoft.com/en-us/windows/win32/sysinfo/windows-time

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to