1 // { dg-options "-std=gnu++2a -pthread" }
2 // { dg-do run { target c++2a } }
3 // { dg-require-effective-target pthread }
4 // { dg-require-gthreads "" }
6 // Copyright (C) 2020 Free Software Foundation, Inc.
8 // This file is part of the GNU ISO C++ Library. This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 3, or (at your option)
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING3. If not see
21 // <http://www.gnu.org/licenses/>.
26 #include <condition_variable>
28 #include <type_traits>
30 #include <testsuite_hooks.h>
33 Tp
check_wait_notify(Tp val1
, Tp val2
)
35 using namespace std::literals::chrono_literals
;
38 std::condition_variable cv
;
41 std::atomic_ref
<Tp
> a(aa
);
49 std::unique_lock
<std::mutex
> l(m
);
51 std::this_thread::sleep_for(100ms
);
59 bool = std::is_integral_v
<Tp
>
60 || std::is_floating_point_v
<Tp
>>
64 struct check
<Tp
, true>
70 VERIFY(check_wait_notify(a
, b
) == b
);
75 struct check
<Tp
, false>
80 VERIFY(check_wait_notify(a
, b
) == b
);