From patchwork Wed Sep 12 14:35:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Crowe X-Patchwork-Id: 969052 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-485517-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mcrowe.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="nyNh5LQ1"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 429PTX2rMmz9s4V for ; Thu, 13 Sep 2018 00:35:44 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=s34Ky+3JmWBt CGwqgfbgYtHp5NBDmAIIyvrOESr30vQGbQ9PiT6KWlMGGMGlPVh3PJbwQUWR9b7m P5dO66/ED/aYpa6aYRE276a9CTMM6Ez3oAgo5dgJqoYJYMDDeASAkofQM8Hp3gdS D2xtjwRpDxcXufcqlt2DbKKHMQY3IXk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=ZSCDjEQrB4EpKKMJJA Xtey6lSzA=; b=nyNh5LQ1bhkAfOl8iaZmac9WmjcRz6fhCOra7fW6+FYmFSEAir 9HylI8jvKFqlVfUrHeIl9wCXGKtUVA/O8CCltflx5QeSA5yiIfZz4iWLhbPSik8H 8YlK4WL5d47ZvYjAGB+pbwQc6RWLO5NBKENohKoKviqOx8CtCk7ptYDpw= Received: (qmail 23301 invoked by alias); 12 Sep 2018 14:35:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 23282 invoked by uid 89); 12 Sep 2018 14:35:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=H*r:smtp, wood, H*Ad:U*mac X-HELO: avasout05.plus.net Received: from avasout05.plus.net (HELO avasout05.plus.net) (84.93.230.250) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Sep 2018 14:35:34 +0000 Received: from deneb ([80.229.24.9]) by smtp with ESMTP id 06EtgMYGM05ij06Eugbfig; Wed, 12 Sep 2018 15:35:32 +0100 X-CM-Score: 0.00 Received: from mac by deneb with local (Exim 4.89) (envelope-from ) id 1g06Es-0005Wc-0i; Wed, 12 Sep 2018 15:35:30 +0100 From: Mike Crowe To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Mike Crowe , Tom Wood Subject: [PATCH] Use steady_clock to implement condition_variable::wait_for with predicate Date: Wed, 12 Sep 2018 15:35:27 +0100 Message-Id: <20180912143527.18621-1-mac@mcrowe.com> In r263225 (d2e378182a12d68fe5caeffae681252662a2fe7b), I fixed condition_variable::wait_for to use std::chrono::steady_clock for the wait. Unfortunately, I failed to spot that the same fix is required for the wait_for variant that takes a predicate too. Reported-by: Tom Wood --- libstdc++-v3/include/std/condition_variable | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable index 1f84ea324eb..24b96e7c295 100644 --- a/libstdc++-v3/include/std/condition_variable +++ b/libstdc++-v3/include/std/condition_variable @@ -158,11 +158,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const chrono::duration<_Rep, _Period>& __rtime, _Predicate __p) { - using __dur = typename __clock_t::duration; + using __dur = typename __steady_clock_t::duration; auto __reltime = chrono::duration_cast<__dur>(__rtime); if (__reltime < __rtime) ++__reltime; - return wait_until(__lock, __clock_t::now() + __reltime, std::move(__p)); + return wait_until(__lock, __steady_clock_t::now() + __reltime, std::move(__p)); } native_handle_type