C ++ 11 std :: this_thread :: sleep_until () freezes when compiling with GCC 4.8.5

Consider the following program:

#include <chrono>
#include <thread>

int main() {
    std::this_thread::sleep_until(std::chrono::steady_clock::now() - std::chrono::seconds(10));

    return 0;
}

When compiling with GCC 4.8.5, it will freeze. When it is compiled with GCC 4.9 and higher or clang3.4 and higher, it immediately returns,

Why is it hanging? As far as I understand, GCC 4.8.5 fully supports the C ++ 11 standard.

+4
source share
2 answers

This is a confirmed bug that was fixed in gcc 4.9.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58038

sleep_until() unsigned long scalar . duratoiin , sleep_for(). , .

+4

sleep_until . , GCC 4.8.5

[33.2.4. ]

-, _until, , . . , . Ct Ct, Ct + Di + Dm, . Ca , :

  • Ca > Ct, , (...), - . [. , . - ] - Ca < Ct,...
+2

Source: https://habr.com/ru/post/1691144/


All Articles