mirror of
https://github.com/boostorg/thread.git
synced 2026-02-03 09:42:16 +00:00
Compare commits
16 Commits
pr/fix-det
...
pr/fix-cyg
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54871e21a1 | ||
|
|
c66c4b1c76 | ||
|
|
fbf8d58ad7 | ||
|
|
46a94dd8ba | ||
|
|
76c7b25d4b | ||
|
|
cc31d32b3f | ||
|
|
7f258e5da3 | ||
|
|
c3897bea65 | ||
|
|
e1e4cbf4be | ||
|
|
d2679fec89 | ||
|
|
ba5632e33a | ||
|
|
9a3b7ff859 | ||
|
|
a35ffa3a83 | ||
|
|
acda67baf4 | ||
|
|
f6609a42dc | ||
|
|
0389f58f23 |
@@ -362,7 +362,7 @@ install:
|
||||
script:
|
||||
- |-
|
||||
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD ;" > ~/user-config.jam
|
||||
- ./b2 -j3 libs/thread/test toolset=$TOOLSET
|
||||
- ./b2 -j3 -l60 libs/thread/test toolset=$TOOLSET
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
||||
@@ -76,4 +76,4 @@ test_script:
|
||||
- ..\..\..\b2 config_info_travis_install %ARGS%
|
||||
- config_info_travis
|
||||
- cd ..\..\thread\test
|
||||
- ..\..\..\b2 --abbreviate-paths -j3 %ARGS%
|
||||
- ..\..\..\b2 --abbreviate-paths -j2 -l60 %ARGS%
|
||||
|
||||
@@ -45,7 +45,7 @@ build_steps: &build_steps
|
||||
command: |
|
||||
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD <cxxflags>$DEFINES ;" > ~/user-config.jam
|
||||
cd ../boost-root
|
||||
./b2 -j8 libs/thread/test toolset=$TOOLSET
|
||||
./b2 -j8 -l60 libs/thread/test toolset=$TOOLSET
|
||||
|
||||
mac_build: &mac_build
|
||||
macos:
|
||||
@@ -137,6 +137,7 @@ jobs:
|
||||
- TOOLSET: "clang"
|
||||
- COMPILER: "clang++"
|
||||
- CXXSTD: "c++11"
|
||||
- CXXFLAGS: "-Wno-unusable-partial-specialization"
|
||||
- DEFINES: "-DBOOST_THREAD_TEST_TIME_MS=100"
|
||||
|
||||
mac-clang++-c++14:
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
#ifndef BOOST_THREAD_DETAIL_THREAD_SAFETY_HPP
|
||||
#define BOOST_THREAD_DETAIL_THREAD_SAFETY_HPP
|
||||
|
||||
#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
//
|
||||
// This is horrible, but it seems to be the only we can shut up the
|
||||
// "anonymous variadic macros were introduced in C99 [-Wvariadic-macros]"
|
||||
// warning that get spewed out otherwise in non-C++11 mode.
|
||||
//
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// See https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
|
||||
|
||||
// Un-comment to enable Thread Safety Analysis
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_WINTHREADS)
|
||||
#if defined(BOOST_THREAD_WIN32)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -58,7 +58,7 @@ namespace boost
|
||||
//it to be linked into the Boost.Threads library.
|
||||
}
|
||||
|
||||
#endif //defined(BOOST_HAS_WINTHREADS)
|
||||
#endif //defined(BOOST_THREAD_WIN32)
|
||||
|
||||
#include <boost/config/abi_suffix.hpp>
|
||||
|
||||
|
||||
@@ -11,7 +11,12 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#ifdef BOOST_NO_CXX11_SFINAE_EXPR
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#else
|
||||
#include <boost/type_traits/declval.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
@@ -33,6 +38,7 @@ namespace boost
|
||||
#ifndef BOOST_THREAD_NO_AUTO_DETECT_MUTEX_TYPES
|
||||
namespace detail
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_SFINAE_EXPR
|
||||
#define BOOST_THREAD_DEFINE_HAS_MEMBER_CALLED(member_name) \
|
||||
template<typename T, bool=boost::is_class<T>::value> \
|
||||
struct has_member_called_##member_name \
|
||||
@@ -142,6 +148,31 @@ namespace boost
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool,value=sizeof(has_member_try_lock<T>::has_member(&T::try_lock))==sizeof(true_type));
|
||||
};
|
||||
#else
|
||||
template<typename T,typename Enabled=void>
|
||||
struct has_member_lock : false_type {};
|
||||
|
||||
template<typename T>
|
||||
struct has_member_lock<T,
|
||||
decltype(void(boost::declval<T&>().lock()))
|
||||
> : true_type {};
|
||||
|
||||
template<typename T,typename Enabled=void>
|
||||
struct has_member_unlock : false_type {};
|
||||
|
||||
template<typename T>
|
||||
struct has_member_unlock<T,
|
||||
decltype(void(boost::declval<T&>().unlock()))
|
||||
> : true_type {};
|
||||
|
||||
template<typename T,typename Enabled=bool>
|
||||
struct has_member_try_lock : false_type {};
|
||||
|
||||
template<typename T>
|
||||
struct has_member_try_lock<T,
|
||||
decltype(bool(boost::declval<T&>().try_lock()))
|
||||
> : true_type {};
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ namespace boost
|
||||
{
|
||||
void* const res=
|
||||
#if defined(_M_ARM64)
|
||||
__iso_volatile_load64((const volatile __int64*)x);
|
||||
(void*)__iso_volatile_load64((const volatile __int64*)x);
|
||||
#else
|
||||
__iso_volatile_load32((const volatile __int32*)x);
|
||||
(void*)__iso_volatile_load32((const volatile __int32*)x);
|
||||
#endif
|
||||
BOOST_THREAD_DETAIL_COMPILER_BARRIER();
|
||||
__dmb(0xB); // _ARM_BARRIER_ISH, see armintr.h from MSVC 11 and later
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_WINTHREADS) && (defined(BOOST_THREAD_BUILD_LIB) || defined(BOOST_THREAD_TEST) || defined(UNDER_CE)) && (!defined(_MSC_VER) || defined(UNDER_CE))
|
||||
#if defined(BOOST_THREAD_WIN32) && (defined(BOOST_THREAD_BUILD_LIB) || defined(BOOST_THREAD_TEST) || defined(UNDER_CE)) && (!defined(_MSC_VER) || defined(UNDER_CE))
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -35,4 +35,4 @@ namespace boost
|
||||
|
||||
}
|
||||
|
||||
#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB) && !defined(_MSC_VER)
|
||||
#endif //defined(BOOST_THREAD_WIN32) && defined(BOOST_THREAD_BUILD_LIB) && !defined(_MSC_VER)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
|
||||
|
||||
#if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_DLL)
|
||||
#if defined(BOOST_THREAD_WIN32) && defined(BOOST_THREAD_BUILD_DLL)
|
||||
|
||||
#include <boost/thread/detail/tss_hooks.hpp>
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
#else //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_DLL)
|
||||
#else //defined(BOOST_THREAD_WIN32) && defined(BOOST_THREAD_BUILD_DLL)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Prevent LNK4221 warning with link=static
|
||||
@@ -82,4 +82,4 @@ namespace boost { namespace link_static_warning_inhibit {
|
||||
} }
|
||||
#endif
|
||||
|
||||
#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_DLL)
|
||||
#endif //defined(BOOST_THREAD_WIN32) && defined(BOOST_THREAD_BUILD_DLL)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <boost/winapi/config.hpp>
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB)
|
||||
#if defined(BOOST_THREAD_WIN32) && defined(BOOST_THREAD_BUILD_LIB)
|
||||
|
||||
#if (defined(__MINGW32__) && !defined(_WIN64)) || defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR)
|
||||
|
||||
@@ -334,4 +334,4 @@ namespace boost
|
||||
|
||||
#endif //defined(_MSC_VER) && !defined(UNDER_CE)
|
||||
|
||||
#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB)
|
||||
#endif //defined(BOOST_THREAD_WIN32) && defined(BOOST_THREAD_BUILD_LIB)
|
||||
|
||||
@@ -296,8 +296,8 @@ rule thread-compile ( sources : reqs * : name )
|
||||
#[ thread-test test_vhh_shared_mutex_timed_locks.cpp ]
|
||||
;
|
||||
|
||||
#explicit t_futures ;
|
||||
test-suite t_futures
|
||||
explicit t_futures_too_long ;
|
||||
test-suite t_futures_too_long
|
||||
:
|
||||
[ thread-test test_futures.cpp ]
|
||||
;
|
||||
@@ -815,6 +815,12 @@ rule thread-compile ( sources : reqs * : name )
|
||||
[ thread-run2-noit ./threads/container/thread_ptr_list_pass.cpp : container__thread_ptr_list_p ]
|
||||
;
|
||||
|
||||
explicit ts_examples_too_long ;
|
||||
test-suite ts_examples_too_long
|
||||
:
|
||||
[ thread-run2 ../example/shared_mutex.cpp : ex_shared_mutex ]
|
||||
;
|
||||
|
||||
#explicit ts_examples ;
|
||||
test-suite ts_examples
|
||||
:
|
||||
@@ -830,7 +836,6 @@ rule thread-compile ( sources : reqs * : name )
|
||||
[ thread-run2-noit ../example/tss.cpp : ex_tss ]
|
||||
[ thread-run2 ../example/xtime.cpp : ex_xtime ]
|
||||
[ thread-run2 ../example/shared_monitor.cpp : ex_shared_monitor ]
|
||||
[ thread-run2 ../example/shared_mutex.cpp : ex_shared_mutex ]
|
||||
#[ thread-run ../example/vhh_shared_monitor.cpp ]
|
||||
#[ thread-run ../example/vhh_shared_mutex.cpp ]
|
||||
[ thread-run2 ../example/make_future.cpp : ex_make_future ]
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_HAS_WINTHREADS)
|
||||
#if defined(BOOST_THREAD_PLATFORM_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
@@ -93,17 +93,28 @@ public:
|
||||
bool wait()
|
||||
{
|
||||
boost::xtime xt = delay(secs);
|
||||
if (type != use_condition)
|
||||
if (type == use_sleep_only) {
|
||||
boost::thread::sleep(xt);
|
||||
if (type != use_sleep_only) {
|
||||
return done;
|
||||
}
|
||||
if (type == use_condition) {
|
||||
boost::unique_lock<boost::mutex> lock(mutex);
|
||||
while (type == use_condition && !done) {
|
||||
while (!done) {
|
||||
if (!cond.timed_wait(lock, xt))
|
||||
break;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
return done;
|
||||
for (int i = 0; ; ++i) {
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lock(mutex);
|
||||
if (done)
|
||||
return true;
|
||||
else if (i > secs * 2)
|
||||
return done;
|
||||
}
|
||||
boost::thread::sleep(delay(0, 500));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user