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

Compare commits

...

16 Commits

Author SHA1 Message Date
Peter Dimov
54871e21a1 Fix uses of BOOST_HAS_WINTHREADS (not correct on Cygwin) 2018-10-13 04:56:08 +03:00
Vicente J. Botet Escriba
c66c4b1c76 Don't report unusable-partial-specialization due to type_traits #93 issue. 2018-10-11 07:28:20 +02:00
Vicente J. Botet Escriba
fbf8d58ad7 Set time limit to 60s 2018-10-10 18:54:23 +02:00
Vicente J. Botet Escriba
46a94dd8ba Extract test too long. 2018-10-10 06:04:17 +02:00
Vicente J. Botet Escriba
76c7b25d4b Extract test too long. 2018-10-09 21:17:24 +02:00
Vicente J. Botet Escriba
cc31d32b3f Merge pull request #243 from Kojoley/execution_monitor-use_mutex-sleep
execution_monitor::use_mutex sleeps the whole timeout duration
2018-10-09 06:25:40 +02:00
Nikita Kniazev
7f258e5da3 execution_monitor::use_mutex sleeps the whole timeout duration
Instead of sleeping the whole timeout duration, sleep for 500ms
in a loop and check every iteration if the job was already done.
2018-10-08 22:34:37 +03:00
Vicente J. Botet Escriba
c3897bea65 Merge pull request #242 from Kojoley/ci-added-tests-timeout
CI: Limit single test execution time to 30 seconds
2018-10-08 20:34:20 +02:00
Vicente J. Botet Escriba
e1e4cbf4be Merge pull request #240 from Kojoley/fix-lockable_traits
Fixed lockable_traits bugs
2018-10-07 19:07:49 +02:00
Nikita Kniazev
d2679fec89 CI: Limit single test execution time to 30 seconds
It should help identify hanging tests that push CI over build time limit.
2018-10-05 20:11:18 +03:00
Vicente J. Botet Escriba
ba5632e33a Merge pull request #241 from Kojoley/suppress-varadic-macro-warnings
Suppress variadic macro warnings
2018-10-05 06:59:50 +02:00
Nikita Kniazev
9a3b7ff859 Suppress variadic macro warnings
The workaround was stolen from `boost/static_assert.hpp` and works in Clang too
2018-10-05 00:47:03 +03:00
Nikita Kniazev
a35ffa3a83 lockable_traits: Use decltype based methods detection
Traits does not detect methods with `noexcept` qualifiers which are part of
function type in C++17 (P0012R1).
2018-10-04 18:36:38 +03:00
Vicente J. Botet Escriba
acda67baf4 Merge pull request #234 from DjArt/develop
Fixing compiling on VS2017 for ARM & ARM64
2018-10-01 05:49:15 +02:00
Vicente J. Botet Escriba
f6609a42dc Merge pull request #235 from boostorg/pr/fix-detail-winapi
Fix boost::detail::winapi references
2018-09-27 20:42:07 +02:00
Dj Art
0389f58f23 Fixing compiling on VS2017 for ARM & ARM64 2018-09-15 03:15:04 +08:00
13 changed files with 79 additions and 22 deletions

View File

@@ -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:

View File

@@ -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%

View File

@@ -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:

View File

@@ -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

View File

@@ -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>

View File

@@ -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
}

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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 ]

View File

@@ -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

View File

@@ -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: