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++/57641] std::timed_mutex.try_lock_until() is broken Date: Tue, 18 Jun 2013 17:27:00 -0000 [thread overview] Message-ID: <bug-57641-4-Pc7HVYNnp4@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-57641-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57641 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Testcase using clock with an earlier epoch: #include <chrono> #include <thread> #include <mutex> #include <assert.h> namespace C = std::chrono; struct clock { typedef C::system_clock::rep rep; typedef C::system_clock::period period; typedef C::system_clock::duration duration; typedef std::chrono::time_point<clock> time_point; static constexpr bool is_steady = C::system_clock::is_steady; static time_point now() { return time_point(C::system_clock::now().time_since_epoch() + C::seconds(10)); } }; std::timed_mutex mx; void f() { mx.try_lock_until(clock::now() + C::milliseconds(1)); } int main() { std::lock_guard<std::timed_mutex> l(mx); auto start = C::system_clock::now(); std::thread t(f); t.join(); auto stop = C::system_clock::now(); assert( (stop - start) < C::seconds(9) ); }
next prev parent reply other threads:[~2013-06-18 17:27 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-06-18 16:29 [Bug libstdc++/57641] New: " mustrumr97 at gmail dot com 2013-06-18 16:58 ` [Bug libstdc++/57641] " redi at gcc dot gnu.org 2013-06-18 17:22 ` mustrumr97 at gmail dot com 2013-06-18 17:27 ` redi at gcc dot gnu.org [this message] 2013-06-18 17:28 ` redi at gcc dot gnu.org 2013-06-18 17:31 ` redi at gcc dot gnu.org 2013-06-18 21:42 ` redi at gcc dot gnu.org 2013-06-18 22:56 ` redi at gcc dot gnu.org 2013-10-07 23:22 ` redi at gcc dot gnu.org 2013-10-07 23:23 ` 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-57641-4-Pc7HVYNnp4@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).