From patchwork Sat Aug 14 20:03:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix libstdc++/45283 From: Jonathan Wakely X-Patchwork-Id: 61736 Message-Id: To: "libstdc++" , gcc-patches Date: Sat, 14 Aug 2010 21:03:47 +0100 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)