public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "m at matthewlai dot ca" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/58038] std::this_thread::sleep_until can cause inifinite sleep Date: Fri, 28 Feb 2014 07:38:00 -0000 [thread overview] Message-ID: <bug-58038-4-hSvwmJS4TS@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-58038-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58038 Matthew Lai <m at matthewlai dot ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m at matthewlai dot ca --- Comment #7 from Matthew Lai <m at matthewlai dot ca> --- I also encountered this bug trying to use std::this_thread::sleep_until() for video frame spacing (so the sleeps are very short, and sometimes become negative). Without this fix there is no way to safely use std::this_thread::sleep_until(), because even if the caller checks for negative sleep durations, there is always the chance that the thread gets preempted after entering the function, and before it checks the current time. Theoretically speaking any amount of time can elapse between those 2 points.
next prev parent reply other threads:[~2014-02-28 7:38 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-07-31 13:27 [Bug libstdc++/58038] New: " mario.bielert@tu-dresden.de 2013-07-31 14:02 ` [Bug libstdc++/58038] " redi at gcc dot gnu.org 2013-07-31 14:17 ` redi at gcc dot gnu.org 2013-07-31 14:35 ` redi at gcc dot gnu.org 2013-07-31 14:37 ` paolo.carlini at oracle dot com 2013-11-18 11:24 ` mario.bielert@tu-dresden.de 2013-11-18 11:42 ` redi at gcc dot gnu.org 2014-02-28 7:38 ` m at matthewlai dot ca [this message] 2014-05-14 20:37 ` m at matthewlai dot ca 2014-09-16 4:11 ` dan at stahlke dot org 2014-09-16 8:17 ` redi at gcc dot gnu.org 2015-03-26 20:06 ` redi at gcc dot gnu.org 2015-03-26 20:09 ` redi at gcc dot gnu.org 2015-03-26 20:09 ` redi at gcc dot gnu.org 2015-03-26 20:27 ` m at matthewlai dot ca 2015-04-11 11:47 ` redi at gcc dot gnu.org 2015-04-11 11:56 ` redi at gcc dot gnu.org
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-58038-4-hSvwmJS4TS@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).