]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/30_threads/this_thread/4.cc
1 // { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
2 // { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
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-nanosleep "" }
9 // Copyright (C) 2008 Free Software Foundation, Inc.
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 2, or (at your option)
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.
22 // You should have received a copy of the GNU General Public License along
23 // with this library; see the file COPYING. If not, write to the Free
24 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
27 // As a special exception, you may use this file as part of a free software
28 // library without restriction. Specifically, if other files instantiate
29 // templates or use macros or inline functions from this file, or you compile
30 // this file and link it with other files to produce an executable, this
31 // file does not by itself cause the resulting executable to be covered by
32 // the GNU General Public License. This exception does not however
33 // invalidate any other reasons why the executable file might be covered by
34 // the GNU General Public License.
38 #include <system_error>
39 #include <testsuite_hooks.h>
41 namespace chr
= std::chrono
;
45 bool test
__attribute__((unused
)) = true;
47 chr::system_clock::time_point begin
= chr::system_clock::now();
48 chr::microseconds
ms(500);
50 std::this_thread::sleep_until(chr::system_clock::now() + ms
);
52 VERIFY( (chr::system_clock::now() - begin
) >= ms
);
57 bool test
__attribute__((unused
)) = true;
64 catch (const std::system_error
&)