]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/thread/test/test_8943.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / thread / test / test_8943.cpp
1 // Copyright (C) 2013 Vicente Botet
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #include <boost/detail/lightweight_test.hpp>
7
8 #if defined(WIN32)
9 #include <tchar.h>
10 #endif
11
12 #include <cstdlib>
13 #include <iostream>
14 #include <boost/thread/once.hpp>
15
16 namespace {
17
18 class foo
19 {
20 public:
21 void operator()() const
22 {
23 std::cout << "foo" << std::endl;
24 }
25 }; // class foo
26
27 }
28
29 #if defined(WIN32)
30 int _tmain(int /*argc*/, _TCHAR* /*argv*/[])
31 #else
32 int main(int /*argc*/, char* /*argv*/[])
33 #endif
34 {
35 try
36 {
37 boost::once_flag once_flag = BOOST_ONCE_INIT;
38 boost::call_once(once_flag, foo());
39 return EXIT_SUCCESS;
40 }
41 catch (...)
42 {
43 std::cerr << "Unknown exception" << std::endl;
44 BOOST_TEST(false);
45 }
46 return boost::report_errors();
47 }