722 Commits

Author SHA1 Message Date
Andrey Semashev 608459ab7c Increased BOOST_THREAD_TEST_TIME_MS yet more because of test failures on Windows. 2026-07-03 21:57:51 +03:00
Andrey Semashev 3f285e5600 Fixed more MSVC warnings about variables shadowing other variables. 2026-07-03 19:17:31 +03:00
Andrey Semashev c28c5a4b28 Try to gracefully finish the timed_join test in case of timeout. 2026-07-03 19:17:31 +03:00
Andrey Semashev 0bdc465f89 Fix uninitialized variable warnings in sync queue tests. 2026-07-03 19:17:31 +03:00
Andrey Semashev aeabeffe4d Silence compiler warnings about unused variables. 2026-07-03 19:17:31 +03:00
Andrey Semashev 6fdc4aa10d Fix mutex assignment tests to actually test that assignment is prohibited.
Previously, mutex assignment tests were copies of the copy constructor
tests and did not verify that the assignment operator was deleted. Fix this.
2026-07-03 19:17:31 +03:00
Andrey Semashev 65410ba739 Reduced OMP thread count to avoid test failures due to resource exhaustion. 2026-07-03 19:17:31 +03:00
Andrey Semashev 171eb5811e Enable OpenMP on gcc for test_9856.
By default, OpenMP is not enabled in gcc, which means the test is run
sequentially and compiler warnings about an unsupported #pragma. Enable
OpenMP for gcc and this particular test.
2026-07-03 14:16:17 +03:00
Andrey Semashev 03db328308 Increased max time differences in tests to improve CI reliability.
Increased BOOST_THREAD_TEST_TIME_MS (a.k.a. max_diff) threshold that is
used in many tests for checking wakeup time delays to 600 ms on systems
other than Linux. This is to account increased delays on VMs that are
used to run CI on BSD systems, which occasionally cause excessively long
latencies in thread communication and wakeups.
2026-07-03 02:45:45 +03:00
Andrey Semashev fbeebd66eb On OpenBSD, disable thread ctor tests that throw from operator new.
The tests crash with SIGSEGV when operator new throws for unknown
reason. The constructor itself works as other, non-throwing tests pass.
2026-07-03 02:40:40 +03:00
Andrey Semashev 5a5554a3a6 Avoid recursively throwing an exception from a custom operator new.
Allocating an exception object may recursively call our custom operator
new, which would result in an infinite recursion and a crash. So only
initiate the throw when the operator is called non-recursively.
Otherwise, let the memory allocation proceed using malloc.
2026-07-03 02:40:40 +03:00
Andrey Semashev 031406d2f3 Removed exception specification from custom operator new overrides.
The specifications are not necessary since C++11 anyway, and we
no longer support C++03.
2026-07-03 02:40:40 +03:00
Andrey Semashev 1ce6bceadf Added checks for the malloc call results in operator new.
The operator new is not supposed to return null pointers, so throw
bad_alloc when malloc returns null. This should avoid segmentation
faults if malloc fails.
2026-07-03 02:40:40 +03:00
Andrey Semashev 55cbdeefe4 Silenced unused variable warning. 2026-07-03 02:40:40 +03:00
Andrey Semashev 884ce13ddd Fix uninitialized variable warnings. 2026-07-03 02:40:40 +03:00
Andrey Semashev 2f9ffdbb63 Removed unused local variables to avoid clang warnings. 2026-07-03 02:40:40 +03:00
Andrey Semashev 79ebce2326 Provide a user-refined copy constructor in check_flag.
This avoids a clang warning about the implicit copy constructor
being deprecated when a user-defined assignment operator is provided.
2026-07-03 02:40:40 +03:00
Andrey Semashev 78190abb18 Avoid relying on timeouts in when_all/when_any tests.
Use thread barriers to synchronize between the main and async threads
instead of relying on timeouts. This should make these tests more
reliable in CI.
2026-07-03 02:40:40 +03:00
Andrey Semashev 3b4615d9e7 Increased timeouts in condition variable notify tests.
Also made reading the waiting flag thread-safe in the notify tests.
2026-07-03 02:40:40 +03:00
Andrey Semashev 7bcb46a9c7 Avoid relying on timeouts in try_lock_until tests for lock types.
Directly compare the absolute timeouts that are passed to try_lock_until
calls with the expected values. This makes the tests more reliable.
2026-07-03 02:40:40 +03:00
Andrey Semashev c8c283c1e7 Adjusted timeouts in wait tests for futures to improve CI reliability. 2026-07-03 02:40:22 +03:00
Andrey Semashev d5c457aa4a Increased timeouts in thread tests to avoid test failures in CI. 2026-07-02 11:29:30 +03:00
Andrey Semashev dd60839a4e Added multiple attemps of timed waits on a cv in mutex lock tests.
Condition variable timed waits may occasionally return true even if
noone notifies on the variable, which breaks the tests that expect
a timeout. This is considered as spurious wakeups. Add a few attempts
at waiting, which should significantly reduce the likelyhood of
test failures.
2026-07-02 11:29:30 +03:00
Andrey Semashev fc290ec4be Renamed global variables to avoid name clashes with local variables.
This should silence MSVC warnings about local variables in various
places shadowing global variables in the tests.
2026-07-02 11:29:30 +03:00
Andrey Semashev b140c29da3 Use barriers in timed try_join tests.
Use thread barriers to synchronize between test threads to improve
test reliability.
2026-07-02 11:29:29 +03:00
Andrey Semashev 559143bde2 Added timeout grace period to condition variable notify tests.
This should reduce the likelihood of test failures due to timeouts.
2026-07-02 11:29:29 +03:00
Andrey Semashev ef5505e0a1 Join test threads before checking for notification count.
In condition variable notification tests, join the test threads
before making the final check for the number of notifications instead
of relying on timeouts. This should make the tests more reliable,
especially on Windows.
2026-07-01 18:43:31 +03:00
Andrey Semashev ac15f907be Fix warnings about missing sized deallocation operator in C++14 mode. 2026-02-06 15:45:40 +03:00
Andrey Semashev e2f6e8789f Fixed uninitialized variable warnings. 2026-02-06 15:21:11 +03:00
Andrey Semashev 24917577d7 Silence unused variable warnings. 2026-02-06 15:14:21 +03:00
Andrey Semashev 6da5c6d418 Updated no_exceptions_support.hpp include to the up-to-date location. 2026-02-06 15:08:13 +03:00
Andrey Semashev de9eb0ee7d Fix signed/unsigned a mismatch warning. 2026-02-06 15:06:51 +03:00
Andrey Semashev f19c0d3b56 Removed usage of deprecated Boost.Test header. 2026-02-06 15:05:38 +03:00
Andrey Semashev 2a953f1c4b Merge pull request #309 from Lastique/fix_bind_warnings
Cleanup header includes
2026-02-06 14:04:41 +03:00
Rene Rivera 814ed9f341 Update build deps. 2024-08-09 22:26:06 -05:00
Rene Rivera e2de571359 Make the library modular usable. 2024-03-11 08:38:17 -05:00
Peter Dimov 710e6fd278 Add boost/thread/detail/string_to_unsigned.hpp 2023-10-14 03:21:14 +03:00
Peter Dimov caa7c111d2 Add boost/thread/detail/string_trim.hpp 2023-10-14 02:53:15 +03:00
Peter Dimov ccc5e3142c Further increase test timeout 2023-09-13 11:08:17 +03:00
Peter Dimov 78af23ca14 Remove tabs 2022-12-31 20:01:31 +02:00
Peter Dimov 1de55fceda Fix test_366_4.cpp 2022-05-14 17:26:50 +03:00
Peter Dimov f71e0f1645 Add test cases for issue #366 (also see comments in #367 and #369) 2022-05-13 21:41:54 +03:00
Peter Dimov fca97a8826 Adjust warning suppression 2021-10-26 05:06:05 +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 f33abfd621 Apply fixes for MinGW 2020-04-06 18:57:29 +03:00
Peter Dimov 119009f2d1 Increase BOOST_THREAD_TEST_TIME on Mac and Cygwin 2020-04-06 11:56:49 +03:00
Andrey Semashev 8ebd61c280 Avoid relying on implicit copy constructor/operator deprecated in C++11.
C++11 deprecates implicit default copy constructors and operators if the class
has user-defined destructor or copy constructor/operator. gcc 9 generates
warnings when this deprecated language feature is used. This commit fixes that
by providing user-defained copy constructors/operators where needed. The
added definitions are equivalent to the implicitly generated by the compiler.

For thread::id, removed copy constructor to allow the compiler generate all
set of constructors and assignment operators, including move.
2020-04-05 02:17:14 +03:00
Andrey Semashev ee609e8806 Cleanup header includes.
1. Make inclusion of boost/bind/bind.hpp conditional in some cases, when the
   code actually conditionally uses boost::bind. Reduces compile-time overhead
   and fixes https://github.com/boostorg/thread/issues/307.

2. Remove some unnecessary uses of boost::ref. This allows to avoid including
   boost/core/ref.hpp in a few places, and avoids the associated template
   instantiation overhead in others.

3. Replace deprecated header includes with the more recent alternatives. For
   example: boost/detail/lightweight_test.hpp -> boost/core/lightweight_test.hpp,
   boost/ref.hpp -> boost/core/ref.hpp.

4. Replace some blanket includes with the more fine-grained ones. For example,
   boost/utility.hpp, boost/atomic.hpp. This reduces compile time overhead.

5. Add some missing includes, for example, boost/core/ref.hpp and
   boost/type_traits/is_same.hpp.

6. Replace uses of std::is_same with boost::is_same (with the corresponding
   included header) since the standard type_traits header presence and validity
   is not tested by the code. Using boost::is_same makes the code more portable.
2020-04-05 01:51:58 +03:00
Peter Dimov c13beec81c Change <boost/bind.hpp> includes to <boost/bind/bind.hpp> to avoid deprecation warning 2020-04-04 19:57:59 +03:00
Vicente J. Botet Escriba 34e354be4c Merge branch 'develop' of https://github.com/boostorg/thread into develop 2019-04-13 09:13:45 +02:00