Control: severity -1 important

Hello,

Mattias Ellert, le dim. 22 févr. 2026 02:14:06 +0100, a ecrit:
> Severity: serious

Nope, serious bugs are only for release archs

> int main() {
>   std::condition_variable cv;
>   std::mutex mx;  
>   std::unique_lock<std::mutex> lk(mx);
>   cv.wait_for(lk, std::chrono::seconds(2));
> }
> 
> $ g++ -o wait_for wait_for.cxx
> $ time ./wait_for 
> 
> real  0m2,002s
> user  0m0,001s
> sys   0m0,001s
> 
> However, when compiled on GNU/Hurd (Debian porterbox exodar.debian.net)
> it hangs forever and must be forced to quit with ctrl-C.
> 
> ellert@exodar:~$ g++ -o wait_for wait_for.cxx -pthread
> ellert@exodar:~$ ./wait_for 

It looks like gcc is mixing monotonic and realtime clocks. Notably, 
/usr/include/i386-gnu/c++/15/bits/c++config.h
shows

/* Defined if clock_gettime has monotonic clock support. */
/* #undef _GLIBCXX_USE_CLOCK_MONOTONIC */

/* Defined if clock_gettime has realtime clock support. */
/* #undef _GLIBCXX_USE_CLOCK_REALTIME */

These should get defined to 1.

Possibly that's because _POSIX_TIMERS is still defined to 0, I haven't
checked what we could be missing for defining it to 1, contribution
welcome.

Samuel

Reply via email to