LIU Hao wrote:

> I will take a look later maybe tomorrow.

Ok.

> For the time being, here are some findings by DeepSeek:
>
> In 0023 there's
>
>> +  error_code = clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts1);
>> +  errno = 0;
>> +  assert(error_code == 0 || (error_code = errno) == ENOTSUP);
>
> Looks like this `errno = 0` should be moved in front of 
> `clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts1)`.
>
> And also clock_settime-process_cputime.c.

That's a nice catch.

> In 0030 there's
>
>> +  /**
>> +   * Total sleep time in milliseconds.
>> +   */
>> +  unsigned __int64 totalSleepTime = winpthreads_timespec_ms (request);
>> ...
>> +  do {
>> +    /**
>> +     * We can sleep for at most `INFINITE - 1` milliseconds at a time.
>> +     */
>> +    unsigned sleepTime;
>> ...
>> +    totalSleepTime -= sleepTime;
>> +    error_code      = _pthread_delay_np_ms (sleepTime);
>> +  } while (totalSleepTime > 0 && likely (error_code == 0));
>> +
>> ...
>> +      if (likely (elapsedSleepTime < totalSleepTime)) {
>> +        remainingSleepTime = totalSleepTime - elapsedSleepTime;
>
> `totalSleepTime` is no longer the value that was returned by 
> `winpthreads_timespec_ms()`, so this looks
> incorrect.

Also a nice catch.

> In 0032 there's
>> -#include "pthread_compat.h"
>> +#include <pthread_compat.h>
>
> Since this includes a header from the same directory, I do suggest this be 
> kept with quotes.

I think using <> is more appropriate here, since ptrhead_time.h is a public 
header file. If it was internal, like winpthreads-time.h, I would agree that 
using quotes is more appropriate. What do you think?

> pthread.h also contains `#include <pthread_unistd.h>` which you can fix later.

I'll fix issues mentioned above and send new version of changes tomorrow.

- Kirill Makurin

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

Reply via email to