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++/58038] std::this_thread::sleep_until can cause inifinite sleep
Date: Wed, 31 Jul 2013 14:17:00 -0000	[thread overview]
Message-ID: <bug-58038-4-cuD37LMJ0j@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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-07-31
     Ever confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
On second thoughts, <chrono> is doing everything as specified by the standard.

It seems unfortunate that we need this, but I don't immediately see any way
around it.  I think I'd prefer to do this than use SFINAE:

  template<typename _Clock, typename _Duration>
    inline void
    sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
    {
      auto __now = _Clock::now();
      // check if we should sleep till a time point in past
      if (std::is_unsigned<typename _Duration::rep>::value && __atime <= __now)
        return;
      sleep_for(__atime - __now);
    }


  parent reply	other threads:[~2013-07-31 14:17 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 [this message]
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
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-cuD37LMJ0j@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: link
Be 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).