From patchwork Sat Aug 14 20:03:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 61736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 50EB3B70D2 for ; Sun, 15 Aug 2010 06:04:27 +1000 (EST) Received: (qmail 9752 invoked by alias); 14 Aug 2010 20:04:24 -0000 Received: (qmail 9739 invoked by uid 22791); 14 Aug 2010 20:04:24 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 14 Aug 2010 20:03:50 +0000 Received: by wwi17 with SMTP id 17so2579692wwi.8 for ; Sat, 14 Aug 2010 13:03:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.21.7 with SMTP id q7mr928913weq.19.1281816227354; Sat, 14 Aug 2010 13:03:47 -0700 (PDT) Received: by 10.216.5.147 with HTTP; Sat, 14 Aug 2010 13:03:47 -0700 (PDT) Date: Sat, 14 Aug 2010 21:03:47 +0100 Message-ID: Subject: Fix libstdc++/45283 From: Jonathan Wakely To: "libstdc++" , gcc-patches 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 2010-08-14 Jonathan Wakely PR libstdc++/45283 * testsuite/performance/30_threads/future/polling.cc: Replace calls to shared_future::is_ready. Tested x86_64/Linux and checked in to trunk. I'll check in to 4.5 too after testing finishes. Index: testsuite/performance/30_threads/future/polling.cc =================================================================== --- testsuite/performance/30_threads/future/polling.cc (revision 163241) +++ testsuite/performance/30_threads/future/polling.cc (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -20,9 +20,14 @@ #include #include +inline bool is_ready(std::shared_future& f) +{ + return f.wait_for(std::chrono::microseconds(1)); +} + void poll(std::shared_future f) { - while (!f.is_ready()) + while (!is_ready(f)) { } } @@ -46,7 +51,7 @@ int main() start_counters(time, resource); for (int i = 0; i < 1000000; ++i) - (void)f.is_ready(); + (void)is_ready(f); p.set_value(); for (int i=0; i < n; ++i)