1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 // Copyright (C) 2011 Vicente J. Botet Escriba
11 // Distributed under the Boost Software License, Version 1.0. (See accompanying
12 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
14 // <boost/thread/thread.hpp>
18 // template <class Clousure> thread(Clousure f);
23 #include <boost/thread/thread_only.hpp>
24 #include <boost/detail/lightweight_test.hpp>
26 #if ! defined BOOST_NO_CXX11_LAMBDAS
28 unsigned throw_one
= 0xFFFF;
30 #if defined _GLIBCXX_THROW
31 void* operator new(std::size_t s
) _GLIBCXX_THROW (std::bad_alloc
)
32 #elif defined BOOST_MSVC
33 void* operator new(std::size_t s
)
34 #elif __cplusplus > 201402L
35 void* operator new(std::size_t s
)
37 void* operator new(std::size_t s
) throw (std::bad_alloc
)
40 if (throw_one
== 0) throw std::bad_alloc();
42 return std::malloc(s
);
45 #if defined BOOST_MSVC
46 void operator delete(void* p
)
48 void operator delete(void* p
) BOOST_NOEXCEPT_OR_NOTHROW
60 boost::thread
t( []() { f_run
= true; } );
62 BOOST_TEST(f_run
== true);
70 boost::thread
t( []() { f_run
= true; } );
81 return boost::report_errors();