{"id":817381,"url":"http://patchwork.ozlabs.org/api/patches/817381/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20170922081728.32508-4-mac@mcrowe.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170922081728.32508-4-mac@mcrowe.com>","list_archive_url":null,"date":"2017-09-22T08:17:27","name":"[RFC,3/4] libstdc++ atomic_futex: Use std::chrono::steady_clock as reference clock","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"27b86ad87a14c831e56a4a5980ac8669020df3cc","submitter":{"id":66786,"url":"http://patchwork.ozlabs.org/api/people/66786/?format=json","name":"Mike Crowe","email":"mac@mcrowe.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20170922081728.32508-4-mac@mcrowe.com/mbox/","series":[{"id":4567,"url":"http://patchwork.ozlabs.org/api/series/4567/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=4567","date":"2017-09-22T08:17:24","name":"Make std::future::wait_* use std::chrono::steady_clock when required","version":1,"mbox":"http://patchwork.ozlabs.org/series/4567/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817381/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817381/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-462757-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-462757-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"mq0G+UF5\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xz5xT4Vzwz9s9Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 18:19:41 +1000 (AEST)","(qmail 28454 invoked by alias); 22 Sep 2017 08:18:28 -0000","(qmail 26721 invoked by uid 89); 22 Sep 2017 08:18:24 -0000","from relay101b.appriver.com (HELO relay.appriver.com)\n\t(207.97.230.15) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 22 Sep 2017 08:18:23 +0000","from [213.210.30.29] (HELO elite.brightsign) by relay.appriver.com\n\t(CommuniGate Pro SMTP 6.1.7) with ESMTPS id 202112912;\n\tFri, 22 Sep 2017 04:18:21 -0400","from chuckie.brightsign ([fd44:d8b8:cab5:cb01::19]\n\thelo=chuckie)\tby elite.brightsign with esmtp (Exim\n\t4.89)\t(envelope-from <mcrowe@brightsign.biz>)\tid\n\t1dvJAC-000B0M-Aa; Fri, 22 Sep 2017 09:18:20 +0100","from mac by chuckie with local (Exim 4.89)\t(envelope-from\n\t<mcrowe@brightsign.biz>)\tid 1dvJAC-0008Tv-A3;\n\tFri, 22 Sep 2017 09:18:20 +0100"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:cc:subject:date:message-id:in-reply-to:references; q=dns; s=\n\tdefault; b=aH9NtjnmnEscHfrShkeESkDxN3z4Z1GVwHqoq1tE0I18PnqJhs4oo\n\t2nwrxREQ6KoH9EO06mi2tqu4QqgrIgC7Z9bn5AyzPeKDMfHAR8u2S5o8PwR/UenP\n\tVEkMpSPSvjute7X27gLgR9Jv4XpdRu7AJdjDko31WsCQrXvYYNnxQA=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:cc:subject:date:message-id:in-reply-to:references; s=\n\tdefault; bh=uOKv3DROSqO/WSjSDZC+0A4maV8=; b=mq0G+UF5eAW4BMj46pfN\n\tsEbaowNNB9I2Qgcj6gk6rUXeEZ8GqmOub/602uUJmjA77OxTMajJFs587ZLqWPkj\n\t4f26fkgqwMKgQFAdOL0TYrtyjdPlnCaW1lyZgqCbWWaQ38612PN/4JqWH5cne+g3\n\t1G4zl6jpaDck8+rBEmYQ5Dg=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tKAM_LAZY_DOMAIN_SECURITY,\n\tRCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=","X-Spam-User":"qpsmtpd, 2 recipients","X-HELO":"relay.appriver.com","X-Note":["This Email was scanned by AppRiver SecureTide","SecureTide Build: 7/20/2017 1:24:22 PM UTC (2.6.20.0)","Filtered by 10.238.11.162","ICH-CT/SI:0-1052/SG:1 9/22/2017 4:18:16 AM","TCH-CT/SI:0-25/SG:1 9/22/2017 4:18:16 AM","Spam Tests Failed:","User Rule Hits:","Global Rule Hits: G281 G282 G283 G284 G288 G289 G418","Encrypt Rule Hits:","Mail Class: VALID","Headers Injected"],"X-Note-AR-ScanTimeLocal":"09/22/2017 4:18:21 AM","X-Policy":["brightsign.biz  - brightsign.biz","brightsign.biz  - brightsign.biz","brightsign.biz  - brightsign.biz"],"X-Primary":"mcrowe@brightsign.biz","X-Virus-Scan":"V-","X-Note-SnifferID":"0","X-GBUdb-Analysis":"0, 213.210.30.29, Ugly c=0.524278 p=-0.876543 Source Normal","X-Signature-Violations":"0-0-0-6281-c","X-Country-Path":"->->United Kingdom->United States","X-Note-Sending-IP":"213.210.30.29","X-Note-Reverse-DNS":"elite.brightsigndigital.co.uk","X-Note-Return-Path":"mcrowe@brightsign.biz","From":"Mike Crowe <mac@mcrowe.com>","To":"libstdc++@gcc.gnu.org,\tgcc-patches@gcc.gnu.org","Cc":"Mike Crowe <mac@mcrowe.com>","Subject":"[RFC PATCH 3/4] libstdc++ atomic_futex: Use\n\tstd::chrono::steady_clock as reference clock","Date":"Fri, 22 Sep 2017 09:17:27 +0100","Message-Id":"<20170922081728.32508-4-mac@mcrowe.com>","In-Reply-To":"<20170922081728.32508-1-mac@mcrowe.com>","References":"<20170922081728.32508-1-mac@mcrowe.com>"},"content":"The user-visible effect of this change is that std::future::wait_for now\nuses std::chrono::steady_clock to determine the timeout. This makes it\nimmune to changes made to the system clock. It also means that anyone using\ntheir own clock types with std::future::wait_until will have the timeout\nconverted to std::chrono::steady_clock rather than\nstd::chrono::system_clock.\n\nNow that use of both std::chrono::steady_clock and\nstd::chrono::system_clock are correctly supported for the wait\ntimeout, I believe that std::chrono::steady_clock is a better choice\nfor the reference clock that is used by std::future::wait_for, and all\nother clocks are converted to, since it is guaranteed to advance\nsteadily. The previous behaviour of converting to\nstd::chrono::system_clock risks timeouts changing dramatically when\nthe system clock is changed.\n\n---\n libstdc++-v3/include/bits/atomic_futex.h | 7 +++----\n 1 file changed, 3 insertions(+), 4 deletions(-)","diff":"diff --git a/libstdc++-v3/include/bits/atomic_futex.h b/libstdc++-v3/include/bits/atomic_futex.h\nindex c2b3df03592..7ba86dfeec7 100644\n--- a/libstdc++-v3/include/bits/atomic_futex.h\n+++ b/libstdc++-v3/include/bits/atomic_futex.h\n@@ -71,7 +71,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n   template <unsigned _Waiter_bit = 0x80000000>\n   class __atomic_futex_unsigned : __atomic_futex_unsigned_base\n   {\n-    typedef chrono::system_clock __clock_t;\n+    typedef chrono::steady_clock __clock_t;\n \n     // This must be lock-free and at offset 0.\n     atomic<unsigned> _M_data;\n@@ -169,7 +169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n     unsigned\n     _M_load_and_test_until_impl(unsigned __assumed, unsigned __operand,\n \tbool __equal, memory_order __mo,\n-\tconst chrono::time_point<__clock_t, _Dur>& __atime)\n+\tconst chrono::time_point<std::chrono::system_clock, _Dur>& __atime)\n     {\n       auto __s = chrono::time_point_cast<chrono::seconds>(__atime);\n       auto __ns = chrono::duration_cast<chrono::nanoseconds>(__atime - __s);\n@@ -229,7 +229,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n       _M_load_when_equal_until(unsigned __val, memory_order __mo,\n \t  const chrono::time_point<_Clock, _Duration>& __atime)\n       {\n-\t// DR 887 - Sync unknown clock to known clock.\n \tconst typename _Clock::time_point __c_entry = _Clock::now();\n \tconst __clock_t::time_point __s_entry = __clock_t::now();\n \tconst auto __delta = __atime - __c_entry;\n@@ -241,7 +240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n     template<typename _Duration>\n     _GLIBCXX_ALWAYS_INLINE bool\n     _M_load_when_equal_until(unsigned __val, memory_order __mo,\n-\tconst chrono::time_point<__clock_t, _Duration>& __atime)\n+\tconst chrono::time_point<std::chrono::system_clock, _Duration>& __atime)\n     {\n       unsigned __i = _M_load(__mo);\n       if ((__i & ~_Waiter_bit) == __val)\n","prefixes":["RFC","3/4"]}