]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/30_threads/async/async.cc
Remove obsolete IRIX 6.5 support
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 30_threads / async / async.cc
CommitLineData
5641963c 1// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } }
2// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } }
a0dadc4a 3// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
4// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
5// { dg-require-cstdint "" }
6// { dg-require-gthreads "" }
7// { dg-require-atomic-builtins "" }
8
1d3b7407 9// Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
a0dadc4a 10//
11// This file is part of the GNU ISO C++ Library. This library is free
12// software; you can redistribute it and/or modify it under the
13// terms of the GNU General Public License as published by the
14// Free Software Foundation; either version 3, or (at your option)
15// any later version.
16
17// This library is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21
22// You should have received a copy of the GNU General Public License along
23// with this library; see the file COPYING3. If not see
24// <http://www.gnu.org/licenses/>.
25
26
27#include <future>
28#include <testsuite_hooks.h>
29
6e7a5cc4 30using namespace std;
31
32struct work {
33 typedef void result_type;
34 void operator()(mutex& m, condition_variable& cv)
35 {
36 unique_lock<mutex> l(m);
37 cv.notify_one();
38 }
39};
40
a0dadc4a 41void test01()
42{
43 bool test __attribute__((unused)) = true;
44
6e7a5cc4 45 mutex m;
46 condition_variable cv;
47 unique_lock<mutex> l(m);
48 future<void> f1 = async(launch::async, work(), ref(m), ref(cv));
49 cv.wait(l);
50 f1.get();
a0dadc4a 51}
52
53int main()
54{
55 test01();
56 return 0;
57}