2
0
mirror of https://github.com/boostorg/thread.git synced 2026-02-03 09:42:16 +00:00

Compare commits

..

12 Commits

Author SHA1 Message Date
Peter Dimov
23e7658347 Add a configuration option for threadapi=pthread/win32, set the default properly on Cygwin 2021-05-30 06:52:40 +03:00
Peter Dimov
190ec21523 Define the macros specific to Boost.Thread in CMakeLists.txt 2021-05-28 02:34:10 +03:00
Peter Dimov
f17d23ac2a Link Boost::thread to Threads::Threads 2021-05-25 21:37:15 +03:00
Peter Dimov
4abafccff4 Add CMakeLists.txt 2021-03-18 18:22:17 +02:00
Peter Dimov
409c98f8b7 Merge pull request #317 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74
2020-08-25 17:23:02 +03:00
Peter Dimov
573296557a Do not define boost::make_exception_ptr, as it's defined in Boost.Exception 2020-08-11 21:26:46 +03:00
Peter Dimov
96cd717b33 Add msvc-14.2/release to Appveyor 2020-07-03 19:49:33 +03:00
Nikita Kniazev
7afa3e9fd4 Fixed optimized away hooks. Fixes #316
MSVC learned to not emit unreferenced symbols with internal linkage and the
hooks were defined in unnamed namespace which forces internal linkage, even if
you mark a variable `extern`.

Since Boost does not have a stable ABI, does not mangle the namespace with
the version, and the hooks are in `boost` namespace (`boost::on_*`) -- there is
no point in trying to hide some symbols because mixing different versions of
boost static libraries will not work already.

I also renamed the `__xl_ca` variable for consistency and because using double
underscored identifiers is forbidden. (`[lex.name]/3`)

The `extern const` is for verbosity and because they are indeed const (it is
done via pragma already).
2020-06-14 17:13:15 +03:00
Edward Diener
f5bf0951be Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero. 2020-04-25 22:38:32 -04:00
Edward Diener
1fceaebe00 Merge branch 'develop' of https://github.com/eldiener/thread into cppbuilder 2020-04-18 19:14:00 -04:00
Edward Diener
30f0ec41fe The corrected DLL entry point for the Embarcadero clang-based compilers. 2020-04-18 17:21:30 -04:00
Edward Diener
1c28a63e26 Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-31 22:29:17 -04:00
18 changed files with 229 additions and 166 deletions

105
CMakeLists.txt Normal file
View File

@@ -0,0 +1,105 @@
# Generated by `boostdep --cmake thread`
# Copyright 2020 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_thread VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(_default_threadapi pthread)
if(WIN32 AND NOT CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
set(_default_threadapi win32)
endif()
set(BOOST_THREAD_THREADAPI ${_default_threadapi} CACHE STRING "Boost.Thread threading API (pthread or win32)")
set_property(CACHE BOOST_THREAD_THREADAPI PROPERTY STRINGS pthread win32)
unset(_default_threadapi)
message(STATUS "Boost.Thread: threading API is ${BOOST_THREAD_THREADAPI}")
if(BOOST_THREAD_THREADAPI STREQUAL win32)
set(THREAD_SOURCES
src/win32/thread.cpp
src/win32/tss_dll.cpp
src/win32/tss_pe.cpp
src/win32/thread_primitives.cpp
src/future.cpp
)
else()
set(THREAD_SOURCES
src/pthread/thread.cpp
src/pthread/once.cpp
src/future.cpp
)
endif()
add_library(boost_thread ${THREAD_SOURCES})
add_library(Boost::thread ALIAS boost_thread)
target_include_directories(boost_thread PUBLIC include)
target_link_libraries(boost_thread
PUBLIC
Boost::assert
Boost::atomic
Boost::bind
Boost::chrono
Boost::concept_check
Boost::config
Boost::container
Boost::container_hash
Boost::core
Boost::date_time
Boost::exception
Boost::function
Boost::intrusive
Boost::io
Boost::iterator
Boost::move
Boost::optional
Boost::predef
Boost::preprocessor
Boost::smart_ptr
Boost::static_assert
Boost::system
Boost::throw_exception
Boost::tuple
Boost::type_traits
Boost::utility
Boost::winapi
Threads::Threads
PRIVATE
Boost::algorithm
Boost::lexical_cast
)
target_compile_definitions(boost_thread
PUBLIC BOOST_THREAD_NO_LIB
PRIVATE BOOST_THREAD_SOURCE
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(boost_thread PUBLIC BOOST_THREAD_DYN_LINK INTERFACE BOOST_THREAD_USE_DLL PRIVATE BOOST_THREAD_BUILD_DLL)
else()
target_compile_definitions(boost_thread PUBLIC BOOST_THREAD_STATIC_LINK INTERFACE BOOST_THREAD_USE_LIB PRIVATE BOOST_THREAD_BUILD_LIB)
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()

View File

@@ -32,10 +32,15 @@ environment:
- TOOLSET: msvc-14.2
CXXSTD: 17
ADDRMD: 64
ADDRMD: 32
VARIANT: debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- TOOLSET: msvc-14.2
ADDRMD: 64
VARIANT: release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- ADDPATH: C:\cygwin\bin;
TOOLSET: gcc
VARIANT: release

View File

@@ -405,7 +405,7 @@
#define BOOST_THREAD_FUTURE_USES_OPTIONAL
#endif
#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
#if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600)
# pragma warn -8008 // Condition always true/false
# pragma warn -8080 // Identifier declared but never used
# pragma warn -8057 // Parameter never used

View File

@@ -601,6 +601,9 @@ namespace boost
class BOOST_SYMBOL_VISIBLE thread::id
{
private:
#if !defined(BOOST_EMBTC)
friend inline
std::size_t
hash_value(const thread::id &v)
@@ -612,6 +615,14 @@ namespace boost
#endif
}
#else
friend
std::size_t
hash_value(const thread::id &v);
#endif
#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
#if defined(BOOST_THREAD_PLATFORM_WIN32)
typedef unsigned int data;
@@ -704,6 +715,21 @@ namespace boost
#endif
#endif
};
#if defined(BOOST_EMBTC)
inline
std::size_t
hash_value(const thread::id &v)
{
#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
return hash_value(v.thread_data);
#else
return hash_value(v.thread_data.get());
#endif
}
#endif
#ifdef BOOST_THREAD_PLATFORM_PTHREAD
inline thread::id thread::get_id() const BOOST_NOEXCEPT

View File

@@ -145,6 +145,8 @@ namespace boost
{}
virtual ~thread_data_base();
#if !defined(BOOST_EMBTC)
friend void intrusive_ptr_add_ref(thread_data_base * p)
{
BOOST_INTERLOCKED_INCREMENT(&p->count);
@@ -158,6 +160,13 @@ namespace boost
}
}
#else
friend void intrusive_ptr_add_ref(thread_data_base * p);
friend void intrusive_ptr_release(thread_data_base * p);
#endif
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
void interrupt()
{
@@ -180,6 +189,24 @@ namespace boost
}
//#endif
};
#if defined(BOOST_EMBTC)
inline void intrusive_ptr_add_ref(thread_data_base * p)
{
BOOST_INTERLOCKED_INCREMENT(&p->count);
}
inline void intrusive_ptr_release(thread_data_base * p)
{
if(!BOOST_INTERLOCKED_DECREMENT(&p->count))
{
detail::heap_delete(p);
}
}
#endif
BOOST_THREAD_DECL thread_data_base* get_current_thread_data();
typedef boost::intrusive_ptr<detail::thread_data_base> thread_data_ptr;

View File

@@ -13,8 +13,10 @@
#include <windows.h>
#if defined(__BORLANDC__)
#if defined(BOOST_BORLANDC)
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/)
#elif defined(BOOST_EMBTC)
extern "C" int _libmain(DWORD dwReason)
#elif defined(_WIN32_WCE)
extern "C" BOOL WINAPI DllMain(HANDLE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/)
#else

View File

@@ -152,19 +152,25 @@ extern BOOL (WINAPI * const _pDefaultRawDllMainOrig)(HINSTANCE, DWORD, LPVOID) =
static PVAPI_V on_process_init();
static PVAPI_V on_process_term();
static void NTAPI on_tls_callback(HINSTANCE, DWORD, PVOID);
}
namespace boost
{
//The .CRT$Xxx information is taken from Codeguru:
//http://www.codeguru.com/Cpp/misc/misc/threadsprocesses/article.php/c6945__2/
// Variables below are not referenced anywhere and
// to not be optimized away has to have external linkage
#if (_MSC_VER >= 1400)
#pragma section(".CRT$XIU",long,read)
#pragma section(".CRT$XCU",long,read)
#pragma section(".CRT$XTU",long,read)
#pragma section(".CRT$XLC",long,read)
__declspec(allocate(".CRT$XLC")) _TLSCB __xl_ca=on_tls_callback;
__declspec(allocate(".CRT$XIU"))_PIFV_ p_tls_prepare = on_tls_prepare;
__declspec(allocate(".CRT$XCU"))_PVFV_ p_process_init = on_process_init;
__declspec(allocate(".CRT$XTU"))_PVFV_ p_process_term = on_process_term;
extern const __declspec(allocate(".CRT$XLC")) _TLSCB p_tls_callback = on_tls_callback;
extern const __declspec(allocate(".CRT$XIU")) _PIFV_ p_tls_prepare = on_tls_prepare;
extern const __declspec(allocate(".CRT$XCU")) _PVFV_ p_process_init = on_process_init;
extern const __declspec(allocate(".CRT$XTU")) _PVFV_ p_process_term = on_process_term;
#else
#if (_MSC_VER >= 1300) // 1300 == VC++ 7.0
# pragma data_seg(push, old_seg)
@@ -176,30 +182,33 @@ extern BOOL (WINAPI * const _pDefaultRawDllMainOrig)(HINSTANCE, DWORD, LPVOID) =
//this could be changed easily if required.
#pragma data_seg(".CRT$XIU")
static _PIFV_ p_tls_prepare = on_tls_prepare;
extern const _PIFV_ p_tls_prepare = on_tls_prepare;
#pragma data_seg()
//Callback after all global ctors.
#pragma data_seg(".CRT$XCU")
static _PVFV_ p_process_init = on_process_init;
extern const _PVFV_ p_process_init = on_process_init;
#pragma data_seg()
//Callback for tls notifications.
#pragma data_seg(".CRT$XLB")
_TLSCB p_thread_callback = on_tls_callback;
extern const _TLSCB p_thread_callback = on_tls_callback;
#pragma data_seg()
//Callback for termination.
#pragma data_seg(".CRT$XTU")
static _PVFV_ p_process_term = on_process_term;
extern const _PVFV_ p_process_term = on_process_term;
#pragma data_seg()
#if (_MSC_VER >= 1300) // 1300 == VC++ 7.0
# pragma data_seg(pop, old_seg)
#endif
#endif
} // namespace boost
namespace
{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4189)

View File

@@ -26,8 +26,6 @@
#pragma warning(disable: 4127) // conditional expression is constant
#endif
namespace boost
{
template <typename T>
struct wrap
{
@@ -37,9 +35,8 @@ struct wrap
};
template <typename T>
exception_ptr make_exception_ptr(T v) {
return copy_exception(wrap<T>(v));
}
boost::exception_ptr make_exception_ptr(T v) {
return boost::copy_exception(wrap<T>(v));
}
void func1(boost::promise<int> p)
@@ -51,7 +48,7 @@ void func1(boost::promise<int> p)
void func2(boost::promise<int> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_exception(boost::make_exception_ptr(3));
p.set_exception(::make_exception_ptr(3));
}
int j = 0;
@@ -66,7 +63,7 @@ void func3(boost::promise<int&> p)
void func4(boost::promise<int&> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_exception(boost::make_exception_ptr(3.5));
p.set_exception(::make_exception_ptr(3.5));
}
void func5(boost::promise<void> p)
@@ -78,7 +75,7 @@ void func5(boost::promise<void> p)
void func6(boost::promise<void> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_exception(boost::make_exception_ptr(4));
p.set_exception(::make_exception_ptr(4));
}
@@ -110,7 +107,7 @@ int main()
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
boost::thread(func2, boost::move(p)).detach();
#else
p.set_exception(boost::make_exception_ptr(3));
p.set_exception(::make_exception_ptr(3));
#endif
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
try
@@ -159,7 +156,7 @@ int main()
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
boost::thread(func4, boost::move(p)).detach();
#else
p.set_exception(boost::make_exception_ptr(3.5));
p.set_exception(::make_exception_ptr(3.5));
#endif
try
{

View File

@@ -36,8 +36,6 @@
#pragma warning(disable: 4127) // conditional expression is constant
#endif
namespace boost
{
template <typename T>
struct wrap
{
@@ -47,9 +45,8 @@ struct wrap
};
template <typename T>
exception_ptr make_exception_ptr(T v) {
return copy_exception(wrap<T>(v));
}
boost::exception_ptr make_exception_ptr(T v) {
return boost::copy_exception(wrap<T>(v));
}
void func1(boost::promise<int> p)
@@ -61,7 +58,7 @@ void func1(boost::promise<int> p)
void func2(boost::promise<int> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_exception(boost::make_exception_ptr(3));
p.set_exception(::make_exception_ptr(3));
}
int j = 0;
@@ -76,7 +73,7 @@ void func3(boost::promise<int&> p)
void func4(boost::promise<int&> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_exception(boost::make_exception_ptr(3.5));
p.set_exception(::make_exception_ptr(3.5));
}
void func5(boost::promise<void> p)
@@ -88,7 +85,7 @@ void func5(boost::promise<void> p)
void func6(boost::promise<void> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_exception(boost::make_exception_ptr(4));
p.set_exception(::make_exception_ptr(4));
}
@@ -120,7 +117,7 @@ int main()
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
boost::thread(func2, boost::move(p)).detach();
#else
p.set_exception(boost::make_exception_ptr(3));
p.set_exception(::make_exception_ptr(3));
#endif
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
try
@@ -133,7 +130,7 @@ int main()
BOOST_TEST(false);
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
}
catch (boost::wrap<int> const& i)
catch (::wrap<int> const& i)
{
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
BOOST_TEST(i.value == 3);
@@ -177,7 +174,7 @@ int main()
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
boost::thread(func4, boost::move(p)).detach();
#else
p.set_exception(boost::make_exception_ptr(3.5));
p.set_exception(::make_exception_ptr(3.5));
#endif
try
{
@@ -185,7 +182,7 @@ int main()
BOOST_TEST(f.get() == 3);
BOOST_TEST(false);
}
catch (boost::wrap<double> const& i)
catch (::wrap<double> const& i)
{
BOOST_TEST(i.value == 3.5);
}
@@ -200,7 +197,7 @@ int main()
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
boost::thread(func4, boost::move(p)).detach();
#else
p.set_exception(boost::make_exception_ptr(3.5));
p.set_exception(::make_exception_ptr(3.5));
#endif
try
{
@@ -238,7 +235,7 @@ int main()
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
boost::thread(func6, boost::move(p)).detach();
#else
p.set_exception(boost::make_exception_ptr(4));
p.set_exception(::make_exception_ptr(4));
#endif
try
{
@@ -246,7 +243,7 @@ int main()
f.get();
BOOST_TEST(false);
}
catch (boost::wrap<int> const& i)
catch (::wrap<int> const& i)
{
BOOST_TEST(i.value == 4);
}

View File

@@ -48,22 +48,6 @@ namespace boost
os << underlying_cast<int>(st) << " ";
return os;
}
template <typename T>
struct wrap
{
wrap(T const& v) :
value(v)
{
}
T value;
};
template <typename T>
exception_ptr make_exception_ptr(T v)
{
return copy_exception(wrap<T> (v));
}
}
void func1(boost::promise<int> p)

View File

@@ -46,22 +46,6 @@ namespace boost
os << underlying_cast<int>(st) << " ";
return os;
}
template <typename T>
struct wrap
{
wrap(T const& v) :
value(v)
{
}
T value;
};
template <typename T>
exception_ptr make_exception_ptr(T v)
{
return copy_exception(wrap<T> (v));
}
}
void func1(boost::promise<int> p)

View File

@@ -49,22 +49,6 @@ namespace boost
os << underlying_cast<int>(st) << " ";
return os;
}
template <typename T>
struct wrap
{
wrap(T const& v) :
value(v)
{
}
T value;
};
template <typename T>
exception_ptr make_exception_ptr(T v)
{
return copy_exception(wrap<T> (v));
}
}
void func1(boost::promise<int> p)

View File

@@ -24,8 +24,6 @@
#include <boost/detail/lightweight_test.hpp>
#include <boost/static_assert.hpp>
namespace boost
{
template <typename T>
struct wrap
{
@@ -38,11 +36,10 @@ namespace boost
};
template <typename T>
exception_ptr make_exception_ptr(T v)
boost::exception_ptr make_exception_ptr(T v)
{
return copy_exception(wrap<T> (v));
return boost::copy_exception(wrap<T> (v));
}
}
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
void func(boost::promise<int> p)
@@ -51,8 +48,8 @@ boost::promise<int> p;
void func()
#endif
{
//p.set_exception(boost::make_exception_ptr(3));
p.set_exception_at_thread_exit(boost::make_exception_ptr(3));
//p.set_exception(::make_exception_ptr(3));
p.set_exception_at_thread_exit(::make_exception_ptr(3));
}
int main()
@@ -72,7 +69,7 @@ int main()
f.get();
BOOST_TEST(false);
}
catch (boost::wrap<int> i)
catch (::wrap<int> i)
{
BOOST_TEST(i.value == 3);
}
@@ -96,7 +93,7 @@ int main()
f.get();
BOOST_TEST(false);
}
catch (boost::wrap<int> i)
catch (::wrap<int> i)
{
BOOST_TEST(i.value == 3);
}

View File

@@ -24,8 +24,6 @@
#include <boost/detail/lightweight_test.hpp>
#include <boost/static_assert.hpp>
namespace boost
{
template <typename T>
struct wrap
{
@@ -38,11 +36,10 @@ namespace boost
};
template <typename T>
exception_ptr make_exception_ptr(T v)
boost::exception_ptr make_exception_ptr(T v)
{
return copy_exception(wrap<T> (v));
return boost::copy_exception(wrap<T> (v));
}
}
int main()
{
@@ -51,19 +48,19 @@ int main()
typedef int T;
boost::promise<T> p;
boost::future<T> f = p.get_future();
p.set_exception(boost::make_exception_ptr(3));
p.set_exception(::make_exception_ptr(3));
try
{
f.get();
BOOST_TEST(false);
}
catch (boost::wrap<int> i)
catch (::wrap<int> i)
{
BOOST_TEST(i.value == 3);
}
try
{
p.set_exception(boost::make_exception_ptr(3));
p.set_exception(::make_exception_ptr(3));
BOOST_TEST(false);
}
catch (const boost::future_error& e)
@@ -79,7 +76,7 @@ int main()
typedef int T;
boost::promise<T> p;
boost::future<T> f = p.get_future();
p.set_exception_deferred(boost::make_exception_ptr(3));
p.set_exception_deferred(::make_exception_ptr(3));
BOOST_TEST(!f.is_ready());
p.notify_deferred();
try
@@ -87,13 +84,13 @@ int main()
f.get();
BOOST_TEST(false);
}
catch (boost::wrap<int> i)
catch (::wrap<int> i)
{
BOOST_TEST(i.value == 3);
}
try
{
p.set_exception(boost::make_exception_ptr(3));
p.set_exception(::make_exception_ptr(3));
BOOST_TEST(false);
}
catch (const boost::future_error& e)

View File

@@ -28,8 +28,6 @@
#if defined BOOST_THREAD_USES_CHRONO
namespace boost
{
template <typename T>
struct wrap
{
@@ -39,9 +37,8 @@ struct wrap
};
template <typename T>
exception_ptr make_exception_ptr(T v) {
return copy_exception(wrap<T>(v));
}
boost::exception_ptr make_exception_ptr(T v) {
return boost::copy_exception(wrap<T>(v));
}
void func1(boost::promise<int> p)
@@ -53,7 +50,7 @@ void func1(boost::promise<int> p)
void func2(boost::promise<int> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_exception(boost::make_exception_ptr(3));
p.set_exception(::make_exception_ptr(3));
}
int j = 0;
@@ -68,7 +65,7 @@ void func3(boost::promise<int&> p)
void func4(boost::promise<int&> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_exception(boost::make_exception_ptr(3.5));
p.set_exception(::make_exception_ptr(3.5));
}
void func5(boost::promise<void> p)
@@ -80,7 +77,7 @@ void func5(boost::promise<void> p)
void func6(boost::promise<void> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_exception(boost::make_exception_ptr(4));
p.set_exception(::make_exception_ptr(4));
}
@@ -106,7 +103,7 @@ int main()
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
boost::thread(func2, boost::move(p)).detach();
#else
p.set_exception(boost::make_exception_ptr(3));
p.set_exception(::make_exception_ptr(3));
#endif
try
{
@@ -114,7 +111,7 @@ int main()
BOOST_TEST(f.get() == 3);
BOOST_TEST(false);
}
catch (boost::wrap<int> const& i)
catch (::wrap<int> const& i)
{
BOOST_TEST(i.value == 3);
}
@@ -146,7 +143,7 @@ int main()
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
boost::thread(func4, boost::move(p)).detach();
#else
p.set_exception(boost::make_exception_ptr(3.5));
p.set_exception(::make_exception_ptr(3.5));
#endif
try
{
@@ -154,7 +151,7 @@ int main()
BOOST_TEST(f.get() == 3);
BOOST_TEST(false);
}
catch (boost::wrap<double> const& i)
catch (::wrap<double> const& i)
{
BOOST_TEST(i.value == 3.5);
}
@@ -181,7 +178,7 @@ int main()
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
boost::thread(func6, boost::move(p)).detach();
#else
p.set_exception(boost::make_exception_ptr(4));
p.set_exception(::make_exception_ptr(4));
#endif
try
{
@@ -189,7 +186,7 @@ int main()
f.get();
BOOST_TEST(false);
}
catch (boost::wrap<int> const& i)
catch (::wrap<int> const& i)
{
BOOST_TEST(i.value == 4);
}

View File

@@ -48,22 +48,6 @@ namespace boost
os << underlying_cast<int>(st) << " ";
return os;
}
template <typename T>
struct wrap
{
wrap(T const& v) :
value(v)
{
}
T value;
};
template <typename T>
exception_ptr make_exception_ptr(T v)
{
return copy_exception(wrap<T> (v));
}
}
void func1(boost::promise<int> p)

View File

@@ -46,22 +46,6 @@ namespace boost
os << underlying_cast<int>(st) << " ";
return os;
}
template <typename T>
struct wrap
{
wrap(T const& v) :
value(v)
{
}
T value;
};
template <typename T>
exception_ptr make_exception_ptr(T v)
{
return copy_exception(wrap<T> (v));
}
}
void func1(boost::promise<int> p)

View File

@@ -49,22 +49,6 @@ namespace boost
os << underlying_cast<int>(st) << " ";
return os;
}
template <typename T>
struct wrap
{
wrap(T const& v) :
value(v)
{
}
T value;
};
template <typename T>
exception_ptr make_exception_ptr(T v)
{
return copy_exception(wrap<T> (v));
}
}
void func1(boost::promise<int> p)