From b9cbb3c98e8f926f00a21b75b70116bcc9d5c1a8 Mon Sep 17 00:00:00 2001 From: redi Date: Sat, 14 Aug 2010 20:00:55 +0000 Subject: 2010-08-14 Jonathan Wakely PR libstdc++/45283 * testsuite/performance/30_threads/future/polling.cc: Replace calls to shared_future::is_ready. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163250 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 6 ++++++ .../testsuite/performance/30_threads/future/polling.cc | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 115679e5e4d..ca4d305e1b9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2010-08-14 Jonathan Wakely + + PR libstdc++/45283 + * testsuite/performance/30_threads/future/polling.cc: Replace calls to + shared_future::is_ready. + 2010-08-13 Paolo Carlini * include/bits/hashtable.h (_Hashtable<>::operator=(const diff --git a/libstdc++-v3/testsuite/performance/30_threads/future/polling.cc b/libstdc++-v3/testsuite/performance/30_threads/future/polling.cc index 50d622c41a6..83fde27100f 100644 --- a/libstdc++-v3/testsuite/performance/30_threads/future/polling.cc +++ b/libstdc++-v3/testsuite/performance/30_threads/future/polling.cc @@ -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) -- cgit v1.2.1