1 // Copyright (C) 2009-2016 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
21 #include <testsuite_performance.h>
23 inline bool is_ready(std::shared_future
<void>& f
)
25 return f
.wait_for(std::chrono::microseconds(1)) == std::future_status::ready
;
28 void poll(std::shared_future
<void> f
)
37 #define thread_type true
40 using namespace __gnu_test
;
42 resource_counter resource
;
46 std::shared_future
<void> f
= p
.get_future();
47 std::thread pollers
[n
];
48 for (int i
=0; i
< n
; ++i
)
49 pollers
[i
] = std::thread(poll
, f
);
51 start_counters(time
, resource
);
53 for (int i
= 0; i
< 1000000; ++i
)
57 for (int i
=0; i
< n
; ++i
)
60 stop_counters(time
, resource
);
61 report_performance(__FILE__
, "", time
, resource
);