public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/60421] std::this_thread::sleep_for doesn't sleep for all arguments Date: Fri, 27 Mar 2015 03:47:00 -0000 [thread overview] Message-ID: <bug-60421-4-UaxGps8LuU@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-60421-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60421 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|5.0 |6.0 --- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- You're right, sorry, I ended up reducing the scope of the fix and it only deals with PR58038, see https://gcc.gnu.org/ml/libstdc++/2015-03/msg00078.html for some commentary. At one point I added: if (__s < chrono::seconds::zero() || __s < __rtime) __s = chrono::seconds::max(); which would detect some cases where the duration_cast to chrono::seconds overflows, but that overflow is still undefined behaviour so I didn't include that in the commit. I want to fix it properly to avoid any undefined behaviour (probably converting to duration<long double> and comparing to duration<time_t>::max()). > I mean when I sleep for UINT64_MAX hours/years/millenia, you can't possibly > wrap that into a single nanosleep call due to the limitations of the type > time_t of the tv_sec parameter of the first argument to nanosleep. One > obviously can not get around using loop. To be honest, I'm not very concerned about the failure to sleep for 290 billion years, if we sleep for duration<time_t>::max() instead of duration<uint64_t>::max() and don't loop you'll never know the difference. > Additionally, the nanosleep code is also missing proper EINTR handling, > which again could break the sleep. Yes, see the mailing list post above. I'll deal with this for gcc 6.
prev parent reply other threads:[~2015-03-27 0:04 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-03-05 9:19 [Bug libstdc++/60421] New: " jaak at ristioja dot ee 2014-03-05 10:50 ` [Bug libstdc++/60421] " plasmahh at gmx dot net 2014-03-05 11:30 ` redi at gcc dot gnu.org 2014-09-19 10:30 ` redi at gcc dot gnu.org 2015-03-26 20:08 ` redi at gcc dot gnu.org 2015-03-26 20:14 ` redi at gcc dot gnu.org 2015-03-26 22:28 ` jaak at ristioja dot ee 2015-03-26 23:45 ` jaak at ristioja dot ee 2015-03-27 3:47 ` redi at gcc dot gnu.org [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-60421-4-UaxGps8LuU@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).