在 2026-10-9 18:18, Kirill Makurin 写道:
Hello,

This is new version of changes. There are a few extra changes:

1. Both `_POSIX_CPUTIME` and `_POSIX_THREAD_CPUTIME` are defined to zero, which tells that feature is supported but may not be available at runtime. Ideally, availability should be checked at runtime by calling `sysconf`, however we do not implement it (should we?).

2. Check for and use of `GetSystemTimeAdjustmentPrecise` are completely removed. I ran clock_getres-* tests after fixing runtime check for it, and It returns nonsensical value of 1s for "time increment". This seems very wrong as `GetSystemTimeAdjustment` returns ~15ms on my system.

I just pushed them for CI run: https://github.com/maiddaisuki/mingw-w64/actions/runs/37914918882 <https://github.com/maiddaisuki/mingw-w64/actions/runs/37914918882>; I expect no issues, but `_POSIX_CPUTIME`/`_POSIX_THREAD_CPUTIME` may result in some unexpected issue somewhere else. This can be fixed with a simple diff.

Thanks. I have pushed these patches, with some typos in commit messages fixed:

 - 'assert that is always succeeds' -> 'assert that it always succeeds'
 - 'Raname' -> 'Rename'
 - 'althout' -> 'although'
 - 'my moving' -> 'by moving'
 - 'unsinged' -> 'unsigned'
 - 'instaed' -> 'instead'


and this (generated by `git diff -b`):

diff --git a/mingw-w64-libraries/winpthreads/src/time.c 
b/mingw-w64-libraries/winpthreads/src/time.c
index c02bfc4c6..6576dc6be 100644
--- a/mingw-w64-libraries/winpthreads/src/time.c
+++ b/mingw-w64-libraries/winpthreads/src/time.c
@@ -375,7 +375,8 @@ int nanosleep64 (const struct _timespec64 *request, struct 
_timespec64 *remain)
   /**
    * Currently, function `_pthread_delay_np_ms` always returns zero.
    */
-  if (unlikely (error_code != 0) && remain != NULL) {
+  if (unlikely (error_code != 0)) {
+    if (remain != NULL) {
       WinpthreadsTimeApi.PtrGetSystemTimePreciseAsFileTime (&endTime);

       ULARGE_INTEGER start = {
@@ -403,6 +404,7 @@ int nanosleep64 (const struct _timespec64 *request, struct 
_timespec64 *remain)

       remain->tv_sec  = (__time64_t) (remainingSleepTime / POW10_3);
       remain->tv_nsec = (long) ((remainingSleepTime % POW10_3) * POW10_6);
+    }

     _set_errno (EINTR);
     return -1;






--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

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

Reply via email to