aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/condition_variable
AgeCommit message (Collapse)AuthorFilesLines
2024-01-03Update copyright years.Jakub Jelinek1-1/+1
2023-11-16libstdc++: Only declare feature test macros in standard headersJonathan Wakely1-1/+1
This change moves the definitions of feature test macros (or strictly speaking, the requests for <bits/version.h> to define them) so that only standard headers define them. For example, <bits/shared_ptr.h> will no longer define macros related to std::shared_ptr, only <memory> and <version> will define them. This means that __cpp_lib_shared_ptr_arrays will not be defined by <future> or by other headers that include <bits/shared_ptr.h>. It will only be defined when <memory> has been included. This will discourage users from relying on transitive includes. As a result, internal headers that need to query the macros should use the internal macros like __glibcxx_shared_ptr_arrays instead of __cpp_lib_shared_ptr_arrays, as those internal macros are defined by the internal headers after icluding <bits/version.h>. There are some exceptions to this rule, because __cpp_lib_is_constant_evaluated is defined by bits/c++config.h and so is available everywhere, and __cpp_lib_three_way_comparison is defined by <compare> which several headers are explicitly specified to include, so its macro is guaranteed to be usable too. N.B. not many internal headers actually need an explicit include of <bits/version.h>, because most of them include <type_traits> and so get all the __glibcxx_foo internal macros from there. libstdc++-v3/ChangeLog: * include/bits/algorithmfwd.h: Do not define standard feature test macro here. * include/bits/align.h: Likewise. Test internal macros instead of standard macros. * include/bits/alloc_traits.h: Likewise. * include/bits/allocator.h: Likewise. * include/bits/atomic_base.h: Likewise. * include/bits/atomic_timed_wait.h: Likewise. * include/bits/atomic_wait.h: Likewise. * include/bits/basic_string.h: Likewise. * include/bits/basic_string.tcc: Likewise. * include/bits/char_traits.h: Likewise. * include/bits/chrono.h: Likewise. * include/bits/cow_string.h: Likewise. * include/bits/forward_list.h: Likewise. * include/bits/hashtable.h: Likewise. * include/bits/ios_base.h: Likewise. * include/bits/memory_resource.h: Likewise. * include/bits/move.h: Likewise. * include/bits/move_only_function.h: Likewise. * include/bits/node_handle.h: Likewise. * include/bits/ptr_traits.h: Likewise. * include/bits/range_access.h: Likewise. * include/bits/ranges_algo.h: Likewise. * include/bits/ranges_cmp.h: Likewise. * include/bits/ranges_util.h: Likewise. * include/bits/semaphore_base.h: Likewise. * include/bits/shared_ptr.h: Likewise. * include/bits/shared_ptr_atomic.h: Likewise. * include/bits/shared_ptr_base.h: Likewise. * include/bits/stl_algo.h: Likewise. * include/bits/stl_algobase.h: Likewise. * include/bits/stl_function.h: Likewise. * include/bits/stl_iterator.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_pair.h: Likewise. * include/bits/stl_queue.h: Likewise. * include/bits/stl_stack.h: Likewise. * include/bits/stl_tree.h: Likewise. * include/bits/stl_uninitialized.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/unique_ptr.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/bits/uses_allocator_args.h: Likewise. * include/bits/utility.h: Likewise. * include/bits/erase_if.h: Add comment. * include/std/algorithm: Define standard feature test macros here. * include/std/atomic: Likewise. * include/std/array: Likewise. * include/std/chrono: Likewise. * include/std/condition_variable: Likewise. * include/std/deque: Likewise. * include/std/format: Likewise. * include/std/functional: Likewise. * include/std/forward_list: Likewise. * include/std/ios: Likewise. * include/std/iterator: Likewise. * include/std/list: Likewise. * include/std/map: Likewise. * include/std/memory: Likewise. * include/std/numeric: Likewise. * include/std/queue: Likewise. * include/std/ranges: Likewise. * include/std/regex: Likewise. * include/std/set: Likewise. * include/std/stack: Likewise. * include/std/stop_token: Likewise. * include/std/string: Likewise. * include/std/string_view: * include/std/tuple: Likewise. * include/std/unordered_map: * include/std/unordered_set: * include/std/utility: Likewise. * include/std/vector: Likewise. * include/std/scoped_allocator: Query internal macros instead of standard macros.
2023-01-16Update copyright years.Jakub Jelinek1-1/+1
2023-01-13libstdc++: Do not include <system_error> in concurrency headersJonathan Wakely1-1/+2
The <condition_variable>, <mutex>, and <shared_mutex> headers use std::errc constants, but don't use std::system_error itself. They only use the __throw_system_error(int) function, which is defined in <bits/functexcept.h>. By including the header for the errc constants instead of the whole of <system_error> we avoid depending on the whole std::string definition. libstdc++-v3/ChangeLog: * include/bits/std_mutex.h: Remove <system_error> include. * include/std/condition_variable: Add <bits/error_constants.h> include. * include/std/mutex: Likewise. * include/std/shared_mutex: Likewise.
2022-10-03libstdc++: Mark headers that must be hosted as such [PR103626]Arsen Arsenović1-0/+2
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding Co-authored-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/103626 * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/bits/requires_hosted.h: New header. * include/experimental/algorithm: Include <bits/requires_hosted.h>. * include/experimental/any: Likewise. * include/experimental/array: Likewise. * include/experimental/buffer: Likewise. * include/experimental/chrono: Likewise. * include/experimental/deque: Likewise. * include/experimental/executor: Likewise. * include/experimental/filesystem: Likewise. * include/experimental/forward_list: Likewise. * include/experimental/functional: Likewise. * include/experimental/internet: Likewise. * include/experimental/io_context: Likewise. * include/experimental/iterator: Likewise. * include/experimental/list: Likewise. * include/experimental/map: Likewise. * include/experimental/memory: Likewise. * include/experimental/memory_resource: Likewise. * include/experimental/net: Likewise. * include/experimental/netfwd: Likewise. * include/experimental/numeric: Likewise. * include/experimental/optional: Likewise. * include/experimental/propagate_const: Likewise. * include/experimental/random: Likewise. * include/experimental/ratio: Likewise. * include/experimental/regex: Likewise. * include/experimental/scope: Likewise. * include/experimental/set: Likewise. * include/experimental/simd: Likewise. * include/experimental/socket: Likewise. * include/experimental/source_location: Likewise. * include/experimental/string: Likewise. * include/experimental/string_view: Likewise. * include/experimental/system_error: Likewise. * include/experimental/timer: Likewise. * include/experimental/tuple: Likewise. * include/experimental/unordered_map: Likewise. * include/experimental/unordered_set: Likewise. * include/experimental/utility: Likewise. * include/experimental/vector: Likewise. * include/std/barrier: Likewise. * include/std/chrono: Likewise. * include/std/condition_variable: Likewise. * include/std/deque: Likewise. * include/std/execution: Likewise. * include/std/filesystem: Likewise. * include/std/forward_list: Likewise. * include/std/fstream: Likewise. * include/std/future: Likewise. * include/std/iomanip: Likewise. * include/std/ios: Likewise. * include/std/iosfwd: Likewise. * include/std/iostream: Likewise. * include/std/istream: Likewise. * include/std/latch: Likewise. * include/std/list: Likewise. * include/std/locale: Likewise. * include/std/map: Likewise. * include/std/memory_resource: Likewise. * include/std/mutex: Likewise. * include/std/ostream: Likewise. * include/std/queue: Likewise. * include/std/random: Likewise. * include/std/regex: Likewise. * include/std/semaphore: Likewise. * include/std/set: Likewise. * include/std/shared_mutex: Likewise. * include/std/spanstream: Likewise. * include/std/sstream: Likewise. * include/std/stack: Likewise. * include/std/stacktrace: Likewise. * include/std/stop_token: Likewise. * include/std/streambuf: Likewise. * include/std/string: Likewise. * include/std/syncstream: Likewise. * include/std/system_error: Likewise. * include/std/thread: Likewise. * include/std/unordered_map: Likewise. * include/std/unordered_set: Likewise. * include/std/valarray: Likewise. * include/std/vector: Likewise. * include/tr1/array: Likewise. * include/tr1/ccomplex: Likewise. * include/tr1/cctype: Likewise. * include/tr1/cfenv: Likewise. * include/tr1/cfloat: Likewise. * include/tr1/cinttypes: Likewise. * include/tr1/climits: Likewise. * include/tr1/cmath: Likewise. * include/tr1/complex: Likewise. * include/tr1/complex.h: Likewise. * include/tr1/cstdarg: Likewise. * include/tr1/cstdbool: Likewise. * include/tr1/cstdint: Likewise. * include/tr1/cstdio: Likewise. * include/tr1/cstdlib: Likewise. * include/tr1/ctgmath: Likewise. * include/tr1/ctime: Likewise. * include/tr1/ctype.h: Likewise. * include/tr1/cwchar: Likewise. * include/tr1/cwctype: Likewise. * include/tr1/fenv.h: Likewise. * include/tr1/float.h: Likewise. * include/tr1/functional: Likewise. * include/tr1/inttypes.h: Likewise. * include/tr1/limits.h: Likewise. * include/tr1/math.h: Likewise. * include/tr1/memory: Likewise. * include/tr1/random: Likewise. * include/tr1/regex: Likewise. * include/tr1/stdarg.h: Likewise. * include/tr1/stdbool.h: Likewise. * include/tr1/stdint.h: Likewise. * include/tr1/stdio.h: Likewise. * include/tr1/stdlib.h: Likewise. * include/tr1/tgmath.h: Likewise. * include/tr1/tuple: Likewise. * include/tr1/type_traits: Likewise. * include/tr1/unordered_map: Likewise. * include/tr1/unordered_set: Likewise. * include/tr1/utility: Likewise. * include/tr1/wchar.h: Likewise. * include/tr1/wctype.h: Likewise. * include/c_global/cmath: Likewise. * include/ext/algorithm: Include <bits/requires_hosted.h>. * include/ext/bitmap_allocator.h: Likewise. * include/ext/cmath: Likewise. * include/ext/codecvt_specializations.h: Likewise. * include/ext/debug_allocator.h: Likewise. * include/ext/enc_filebuf.h: Likewise. * include/ext/extptr_allocator.h: Likewise. * include/ext/functional: Likewise. * include/ext/malloc_allocator.h: Likewise. * include/ext/memory: Likewise. * include/ext/mt_allocator.h: Likewise. * include/ext/new_allocator.h: Likewise. * include/ext/numeric: Likewise. * include/ext/pod_char_traits.h: Likewise. * include/ext/pool_allocator.h: Likewise. * include/ext/random: Likewise. * include/ext/random.tcc: Likewise. * include/ext/rb_tree: Likewise. * include/ext/rc_string_base.h: Likewise. * include/ext/rope: Likewise. * include/ext/ropeimpl.h: Likewise. * include/ext/slist: Likewise. * include/ext/sso_string_base.h: Likewise. * include/ext/stdio_filebuf.h: Likewise. * include/ext/stdio_sync_filebuf.h: Likewise. * include/ext/string_conversions.h: Likewise. * include/ext/throw_allocator.h: Likewise. * include/ext/vstring.h: Likewise. * include/ext/vstring.tcc: Likewise. * include/ext/vstring_fwd.h: Likewise. * include/ext/vstring_util.h: Likewise. * include/std/charconv: Likewise. (__cpp_lib_to_chars): Do not define for freestanding. * include/std/version: Adjust which macros get defined in freestanding. * include/ext/pointer.h [!_GLIBCXX_HOSTED]: Omit iostream functionality from freestanding. * include/std/algorithm [!_GLIBCXX_HOSTED]: Omit PSTL algos. * include/std/memory [!_GLIBCXX_HOSTED]: Omit <bits/stl_tempbuf.h> in freestanding * include/bits/algorithmfwd.h [!_GLIBCXX_HOSTED]: Omit leftover random_shuffle and stable_partition definition. * include/bits/stl_algo.h [!_GLIBCXX_HOSTED]: Omit random_shuffle and stable_partition from freestanding. * include/bits/ranges_algo.h [!_GLIBCXX_HOSTED]: Omit stable_partition from freestanding. * include/bits/concept_check.h: Remove needless HOSTED check. * include/std/iterator: Include <bits/ranges_base.h>. * include/std/numeric (__cpp_lib_parallel_algorithms): Do not define for freestanding. * include/std/functional (__cpp_lib_boyer_moore_searcher): Likewise. * testsuite/lib/prune.exp: Match error for hosted-only libstdc++ tests.
2022-05-13libstdc++: Add macros for the inline namespace std::_V2Jonathan Wakely1-2/+2
Use macros to open and close the inline namespace _V2 that is used for ABI versioning of individual components such as chrono::system_clock. This allows the namespace to be hidden in the docs generated by Doxygen, so that we document std::foo instead of std::_V2::foo. This also makes it easy to remove that namespace entirely for the gnu-versioned-namespace build, where everything is already versioned as std::__8 and there are no backwards compatibility guarantees. libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (PREDEFINED): Expand new macros to nothing. * include/bits/c++config (_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE) (_GLIBCXX_END_INLINE_ABI_NAMESPACE): Define new macros. * include/bits/algorithmfwd.h (_V2::__rotate): Use new macros for the namespace. * include/bits/chrono.h (chrono::_V2::system_clock): Likewise. * include/bits/stl_algo.h (_V2::__rotate): Likewise. * include/std/condition_variable (_V2::condition_variable_any): Likewise. * include/std/system_error (_V2::error_category): Likewise.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-12-09libstdc++: Allow std::condition_variable waits to be cancelled [PR103382]Jonathan Wakely1-1/+1
std::condition_variable::wait(unique_lock<mutex>&) is incorrectly marked noexcept, which means that the __forced_unwind exception used by NPTL cancellation will terminate the process. It should allow exceptions to pass through, so that a thread can be cleanly cancelled when waiting on a condition variable. The new behaviour is exported as a new version of the symbol, to avoid an ABI break for existing code linked to the non-throwing definition of the function. Code linked against older releases will have a reference to the @GLIBCXX_3.4.11 version, andcode compiled against the new libstdc++ will get a reference to the @@GLIBCXX_3.4.30 version. libstdc++-v3/ChangeLog: PR libstdc++/103382 * config/abi/pre/gnu.ver (GLIBCXX_3.4.11): Do not export old symbol if .symver renaming is supported. (GLIBCXX_3.4.30): Export new symbol if .symver renaming is supported. * doc/xml/manual/evolution.xml: Document change. * doc/html/manual/api.html: Regenerate. * include/bits/std_mutex.h (__condvar::wait, __condvar::wait_until): Remove noexcept. * include/std/condition_variable (condition_variable::wait): Likewise. * src/c++11/condition_variable.cc (condition_variable::wait): Likewise. * src/c++11/compatibility-condvar.cc (__nothrow_wait_cv::wait): Define nothrow wrapper around std::condition_variable::wait and export the old symbol as an alias to it. * testsuite/30_threads/condition_variable/members/103382.cc: New test.
2021-10-07libstdc++: Move C++14 <chrono> components to new <bits/chrono.h> headerJonathan Wakely1-2/+1
This moves the "classic" contents of <chrono> to a new header, so that <future>, <thread> etc. can get use durations and clocks without calendar types, time zones, and chrono I/O. libstdc++-v3/ChangeLog: * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/std/chrono (duration, time_point, system_clock) (steady_clock, high_resolution_clock, chrono_literals, sys_time) (file_clock, file_time): Move to ... * include/bits/chrono.h: New file. * include/bits/atomic_futex.h: Include new header instead of <chrono>. * include/bits/atomic_timed_wait.h: Likewise. * include/bits/fs_fwd.h: Likewise. * include/bits/semaphore_base.h: Likewise. * include/bits/this_thread_sleep.h: Likewise. * include/bits/unique_lock.h: Likewise. * include/experimental/bits/fs_fwd.h: Likewise. * include/experimental/chrono: Likewise. * include/experimental/io_context: Likewise. * include/experimental/netfwd: Likewise. * include/experimental/timer: Likewise. * include/std/condition_variable: Likewise. * include/std/mutex: Likewise. * include/std/shared_mutex: Likewise.
2021-04-06libstdc++: Fix doxygen markup for group close commandsJonathan Wakely1-1/+1
A change in Doxygen 1.8.16 means that "// @}" is no longer recognized by Doxygen, so doesn't close a @{ group. A "///" comment needs to be used. libstdc++-v3/ChangeLog: * include/bits/atomic_base.h: Fix doxygen group close. * include/bits/basic_ios.h: Likewise. * include/bits/forward_list.h: Likewise. * include/bits/fs_dir.h: Likewise. * include/bits/fs_ops.h: Likewise. * include/bits/fs_path.h: Likewise. * include/bits/functional_hash.h: Likewise. * include/bits/gslice.h: Likewise. * include/bits/gslice_array.h: Likewise. * include/bits/hashtable_policy.h: Likewise. * include/bits/indirect_array.h: Likewise. * include/bits/locale_classes.h: Likewise. * include/bits/locale_facets.h: Likewise. * include/bits/locale_facets_nonio.h: Likewise. * include/bits/mask_array.h: Likewise. * include/bits/refwrap.h: Likewise. * include/bits/regex.h: Likewise. * include/bits/regex_automaton.h: Likewise. * include/bits/regex_compiler.h: Likewise. * include/bits/regex_constants.h: Likewise. * include/bits/regex_error.h: Likewise. * include/bits/regex_executor.h: Likewise. * include/bits/regex_scanner.h: Likewise. * include/bits/shared_ptr.h: Likewise. * include/bits/shared_ptr_atomic.h: Likewise. * include/bits/shared_ptr_base.h: Likewise. * include/bits/slice_array.h: Likewise. * include/bits/specfun.h: Likewise. * include/bits/std_function.h: Likewise. * include/bits/std_mutex.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_iterator.h: Likewise. * include/bits/stl_iterator_base_types.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_numeric.h: Likewise. * include/bits/stl_pair.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_uninitialized.h: Likewise. * include/bits/stream_iterator.h: Likewise. * include/bits/streambuf_iterator.h: Likewise. * include/bits/unique_ptr.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/decimal/decimal: Likewise. * include/experimental/any: Likewise. * include/experimental/array: Likewise. * include/experimental/bits/fs_dir.h: Likewise. * include/experimental/bits/fs_fwd.h: Likewise. * include/experimental/bits/fs_ops.h: Likewise. * include/experimental/bits/fs_path.h: Likewise. * include/experimental/buffer: Likewise. * include/experimental/internet: Likewise. * include/experimental/optional: Likewise. * include/experimental/propagate_const: Likewise. * include/experimental/socket: Likewise. * include/ext/pb_ds/assoc_container.hpp: Likewise. * include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Likewise. * include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Likewise. * include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Likewise. * include/ext/pb_ds/detail/types_traits.hpp: Likewise. * include/ext/pb_ds/exception.hpp: Likewise. * include/ext/pb_ds/priority_queue.hpp: Likewise. * include/ext/pb_ds/tag_and_trait.hpp: Likewise. * include/ext/random: Likewise. * include/std/any: Likewise. * include/std/atomic: Likewise. * include/std/bitset: Likewise. * include/std/chrono: Likewise. * include/std/complex: Likewise. * include/std/condition_variable: Likewise. * include/std/fstream: Likewise. * include/std/future: Likewise. * include/std/iostream: Likewise. * include/std/istream: Likewise. * include/std/mutex: Likewise. * include/std/numeric: Likewise. * include/std/ostream: Likewise. * include/std/ratio: Likewise. * include/std/shared_mutex: Likewise. * include/std/stdexcept: Likewise. * include/std/streambuf: Likewise. * include/std/system_error: Likewise. * include/std/thread: Likewise. * include/std/valarray: Likewise. * include/std/variant: Likewise. * include/tr1/cmath: Likewise. * include/tr1/regex: Likewise. * include/tr2/dynamic_bitset: Likewise. * libsupc++/atomic_lockfree_defines.h: Likewise. * libsupc++/exception: Likewise. * libsupc++/exception.h: Likewise. * libsupc++/exception_ptr.h: Likewise. * libsupc++/nested_exception.h: Likewise. libstdc++-v3/ChangeLog: * include/tr1/regex:
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-11-25libstdc++: Encapsulate __gthread_cond_t as std::__condvarJonathan Wakely1-13/+5
This introduces a new internal utility, std::__condvar, which is a simplified form of std::condition_variable. It has no dependency on <chrono> or std::unique_lock, which allows it to be used in <bits/atomic_wait.h>. This avoids repeating the #ifdef __GTHREAD_COND_INIT preprocessor conditions and associated logic for initializing a __gthread_cond_t correctly. It also encapsulates most of the __gthread_cond_xxx functions as member functions of __condvar. libstdc++-v3/ChangeLog: * include/bits/atomic_timed_wait.h (__cond_wait_until_impl): Do not define when _GLIBCXX_HAVE_LINUX_FUTEX is defined. Use __condvar and mutex instead of __gthread_cond_t and unique_lock<mutex>. (__cond_wait_until): Likewise. Fix test for return value of __cond_wait_until_impl. (__timed_waiters::_M_do_wait_until): Use __condvar instead of __gthread_cond_t. * include/bits/atomic_wait.h: Remove <bits/unique_lock.h> include. Only include <bits/std_mutex.h> if not using futexes. (__platform_wait_max_value): Remove unused variable. (__waiters::lock_t): Use lock_guard instead of unique_lock. (__waiters::_M_cv): Use __condvar instead of __gthread_cond_t. (__waiters::_M_do_wait(__platform_wait_t)): Likewise. (__waiters::_M_notify()): Likewise. Use notify_one() if not asked to notify all. * include/bits/std_mutex.h (__condvar): New type. * include/std/condition_variable (condition_variable::_M_cond) (condition_variable::wait_until): Use __condvar instead of __gthread_cond_t. * src/c++11/condition_variable.cc (condition_variable): Define default constructor and destructor as defaulted. (condition_variable::wait, condition_variable::notify_one) (condition_variable::notify_all): Forward to corresponding member function of __condvar.
2020-10-22libstdc++: Reduce header dependencies in and on <memory>Jonathan Wakely1-3/+0
By moving std::make_obj_using_allocator and the related "utility functions for uses-allocator construction" to a new header, we can avoid including the whole of <memory> in <scoped_allocator> and <memory_resource>. In order to simplify the implementation of those utility functions they now use concepts unconditionally. They are no longer defined if __cpp_concepts is not defined. To simplify the code that uses those functions I've introduced a __cpp_lib_make_obj_using_allocator feature test macro (not specified in the standard, which might be an oversight). That allows the code in <memory_resource> and <scoped_allocator> to check the feature test macro to decide whether to use the new utilities, or fall back to the C++17 code. At the same time, this reshuffles some of the headers included by <memory> so that they are (mostly?) self-contained. It should no longer be necessary to include other headers before <bits/shared_ptr.h> when other parts of the library want to use std::shared_ptr without including the whole of <memory>. libstdc++-v3/ChangeLog: * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/bits/shared_ptr.h: Include <iosfwd>. * include/bits/shared_ptr_base.h: Include required headers here directly, instead of in <memory>. * include/bits/uses_allocator_args.h: New file. Move utility functions for uses-allocator construction from <memory> to here. Only define the utility functions when concepts are available. (__cpp_lib_make_obj_using_allocator): Define non-standard feature test macro. * include/std/condition_variable: Remove unused headers. * include/std/future: Likewise. * include/std/memory: Remove headers that are not needed directly, and are now inclkuded where they're needed. Include new <bits/uses_allocator_args.h> header. * include/std/memory_resource: Include only the necessary headers. Use new feature test macro to detect support for the utility functions. * include/std/scoped_allocator: Likewise. * include/std/version (__cpp_lib_make_obj_using_allocator): Define.
2020-09-11libstdc++: Avoid rounding errors on custom clocks in condition_variableMike Crowe1-9/+9
The fix for PR68519 in 83fd5e73b3c16296e0d7ba54f6c547e01c7eae7b only applied to condition_variable::wait_for. This problem can also apply to condition_variable::wait_until but only if the custom clock is using a more recent epoch so that a small enough delta can be calculated. let's use the newly-added chrono::__detail::ceil to fix this and also make use of that function to simplify the previous wait_for fixes. Also, simplify the existing test case for PR68519 a little and make its variables local so we can add a new test case for the above problem. Unfortunately, the test would have only started failing if sufficient time has passed since the chrono::steady_clock epoch had passed anyway, but it's better than nothing. libstdc++-v3/ChangeLog: * include/std/condition_variable (condition_variable::wait_until): Convert delta to steady_clock duration before adding to current steady_clock time to avoid rounding errors described in PR68519. (condition_variable::wait_for): Simplify calculation of absolute time by using chrono::__detail::ceil in both overloads. * testsuite/30_threads/condition_variable/members/68519.cc: (test_wait_for): Renamed from test01. Replace unassigned val variable with constant false. Reduce scope of mx and cv variables to just test_wait_for function. (test_wait_until): Add new test case.
2020-09-10libstdc++: Fix -Wdeprecated-declarations warningsJonathan Wakely1-0/+3
libstdc++-v3/ChangeLog: * include/experimental/bits/shared_ptr.h (shared_ptr(auto_ptr&&)) (operator=(auto_ptr&&)): Add diagnostic pragmas to suppress warnings for uses of std::auto_ptr. * include/experimental/type_traits (is_literal_type_v): Likewise, for use of std::is_literal_type. * include/std/condition_variable (condition_variable_any::_Unlock): Likewise, for use of std::uncaught_exception.
2020-04-22libstdc++: Update value of __cpp_lib_jthread macroJonathan Wakely1-2/+1
* include/std/condition_variable (__cpp_lib_jthread): Remove redundant definition. * include/std/stop_token (__cpp_lib_jthread): Update macro value to indicate P1869R1 support. * include/std/version (__cpp_lib_jthread): Update value. * testsuite/30_threads/condition_variable_any/stop_token/1.cc: Check for updated macro value. * testsuite/30_threads/condition_variable_any/stop_token/2.cc: Likewise. * testsuite/30_threads/jthread/1.cc: Likewise. * testsuite/30_threads/jthread/2.cc: Likewise. * testsuite/30_threads/stop_token/1.cc: Likewise. * testsuite/30_threads/stop_token/2.cc: Likewise.
2020-03-25libstdc++: Define and use chrono::is_clock for C++20Jonathan Wakely1-0/+3
For C++20 the wait_until members of mutexes and condition variables are required to be ill-formed if given a clock that doesn't meet the requirements for a clock type. To implement that requirement this patch adds static assertions using the chrono::is_clock trait, and defines that trait. To avoid expensive checks for the common cases, the trait (and associated variable template) are explicitly specialized for the standard clock types. This also moves the filesystem::__file_clock type from <filesystem> to <chrono>, so that chrono::file_clock and chrono::file_time can be defined in <chrono> as required. * include/bits/fs_fwd.h (filesystem::__file_clock): Move to ... * include/std/chrono (filesystem::__file_clock): Here. (filesystem::__file_clock::from_sys, filesystem::__file_clock::to_sys): Define public member functions for C++20. (is_clock, is_clock_v): Define traits for C++20. * include/std/condition_variable (condition_variable::wait_until): Add check for valid clock. * include/std/future (_State_baseV2::wait_until): Likewise. * include/std/mutex (__timed_mutex_impl::_M_try_lock_until): Likewise. * include/std/shared_mutex (shared_timed_mutex::try_lock_shared_until): Likewise. * include/std/thread (this_thread::sleep_until): Likewise. * testsuite/30_threads/condition_variable/members/2.cc: Qualify slow_clock with new namespace. * testsuite/30_threads/condition_variable/members/clock_neg.cc: New test. * testsuite/30_threads/condition_variable_any/members/clock_neg.cc: New test. * testsuite/30_threads/future/members/clock_neg.cc: New test. * testsuite/30_threads/recursive_timed_mutex/try_lock_until/3.cc: Qualify slow_clock with new namespace. * testsuite/30_threads/recursive_timed_mutex/try_lock_until/ clock_neg.cc: New test. * testsuite/30_threads/shared_future/members/clock_neg.cc: New test. * testsuite/30_threads/shared_lock/locking/clock_neg.cc: New test. * testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc: New test. * testsuite/30_threads/timed_mutex/try_lock_until/3.cc: Qualify slow_clock with new namespace. * testsuite/30_threads/timed_mutex/try_lock_until/4.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc: New test. * testsuite/30_threads/unique_lock/locking/clock_neg.cc: New test. * testsuite/std/time/traits/is_clock.cc: New test. * testsuite/util/slow_clock.h (slow_clock): Move to __gnu_test namespace.
2020-01-08Rename condition_variable_any wait* methods to match current draft standardThomas Rodgers1-15/+15
2020-01-07 Thomas Rodgers <trodgers@redhat.com> * include/std/condition_variable (condition_variable_any::wait_on): Rename to match current draft standard. (condition_variable_any::wait_on_until): Likewise. (condition_variable_any::wait_on_for): Likewise. * testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc: Adjust tests to account for renamed methods. From-SVN: r279988
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-11-15Support for jthread and stop_tokenThomas Rodgers1-0/+84
* include/Makefile.am: Add <stop_token> header. * include/Makefile.in: Regenerate. * include/std/condition_variable: Add overloads for stop_token support to condition_variable_any. * include/std/stop_token: New file. * include/std/thread: Add jthread type. * include/std/version (__cpp_lib_jthread): New value. * testsuite/30_threads/condition_variable_any/stop_token/1.cc: New test. * testsuite/30_threads/condition_variable_any/stop_token/2.cc: New test. * testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc: New test. * testsuite/30_threads/jthread/1.cc: New test. * testsuite/30_threads/jthread/2.cc: New test. * testsuite/30_threads/jthread/jthread.cc: New test. * testsuite/30_threads/stop_token/1.cc: New test. * testsuite/30_threads/stop_token/2.cc: New test. * testsuite/30_threads/stop_token/stop_token.cc: New test. From-SVN: r278274
2019-09-04PR libstdc++/41861 Add full steady_clock support to condition_variableMike Crowe1-11/+51
The pthread_cond_clockwait function is available in glibc since the 2.30 release. If this function is available in the C library it can be used to fix PR libstdc++/41861 by supporting std::chrono::steady_clock properly with std::condition_variable. This means that code using std::condition_variable::wait_for or std::condition_variable::wait_until with std::chrono::steady_clock is no longer subject to timing out early or potentially waiting for much longer if the system clock is warped at an inopportune moment. If pthread_cond_clockwait is available then std::chrono::steady_clock is deemed to be the "best" clock available which means that it is used for the relative wait_for calls and absolute wait_until calls using user-defined clocks. Calls explicitly using std::chrono::system_clock continue to use CLOCK_REALTIME via __gthread_cond_timedwait. If pthread_cond_clockwait is not available then std::chrono::system_clock is deemed to be the "best" clock available which means that the previous suboptimal behaviour remains. 2019-09-04 Mike Crowe <mac@mcrowe.com> PR libstdc++/41861 * acinclude.m4 (GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT): Check for new pthread_cond_clockwait function. * configure.ac: Use GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT. * configure: Regenerate. * config.h.in: Regenerate. * include/std/condition_variable: (condition_variable): Rename __steady_clock_t typedef and add system_clock. Change __clock_t to be a typedef for the preferred clock to convert arbitrary other clocks to. [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT] (wait_until): Add a steady_clock overload. (wait_until): Change __clock_t overload to use system_clock. [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT] (__wait_until_impl): Add steady_clock overload that calls pthread_cond_clockwait. (__wait_until_impl): Change __clock_t overload to use system_clock. (condition_variable_any) [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT]: Use steady_clock for __clock_t if pthread_cond_clockwait is available. From-SVN: r275390
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-09-25Use steady_clock to implement condition_variable::wait_for with predicateMike Crowe1-2/+3
In r263225 (d2e378182a12d68fe5caeffae681252662a2fe7b), I fixed condition_variable::wait_for to use std::chrono::steady_clock for the wait. Unfortunately, I failed to spot that the same fix is required for the wait_for variant that takes a predicate too. 2018-09-25 Mike Crowe <mac@mcrowe.com> * include/std/condition_variable (condition_variable::wait_for): Use steady clock in overload that uses a predicate. From-SVN: r264575
2018-08-01Use steady_clock to implement condition_variable::wait_forMike Crowe1-2/+3
The C++ standard says that std::condition_variable::wait_for should be implemented to be equivalent to: return wait_until(lock, chrono::steady_clock::now() + rel_time); But the existing implementation uses chrono::system_clock. Now that wait_until has potentially-different behaviour for chrono::steady_clock, let's at least try to wait using the correct clock. 2018-08-01 Mike Crowe <mac@mcrowe.com> * include/std/condition_variable (wait_for): Use steady_clock. From-SVN: r263225
2018-08-01Report early wakeup of condition_variable::wait_until as no_timeoutMike Crowe1-1/+8
As currently implemented, condition_variable always ultimately waits against std::chrono::system_clock. This clock can be changed in arbitrary ways by the user which may result in us waking up too early or too late when measured against the caller-supplied clock. We can't (yet) do much about waking up too late (PR 41861), but if we wake up too early we must return cv_status::no_timeout to indicate a spurious wakeup rather than incorrectly returning cv_status::timeout. 2018-08-01 Mike Crowe <mac@mcrowe.com> * include/std/condition_variable (wait_until): Only report timeout if we really have timed out when measured against the caller-supplied clock. * testsuite/30_threads/condition_variable/members/2.cc: Add test case to confirm above behaviour. From-SVN: r263224
2018-07-26Remove <chrono> dependency on _GLIBCXX_USE_C99_STDINT_TR1Jonathan Wakely1-4/+2
By adding fallback definitions of std::intmax_t and std::uintmax_t it's possible to define <ratio> without _GLIBCXX_USE_C99_STDINT_TR1. This in turn allows most of <chrono> to be defined, which removes the dependency on _GLIBCXX_USE_C99_STDINT_TR1 for all of the C++11 concurrency features. The compiler defines __INTMAX_TYPE__ and __UINTMAX_TYPE__ unconditionally so it should be safe to rely on them. * include/bits/atomic_futex.h [!_GLIBCXX_USE_C99_STDINT_TR1] (__atomic_futex_unsigned_base): Remove dependency on _GLIBCXX_USE_C99_STDINT_TR1 macro. * include/bits/unique_lock.h [!_GLIBCXX_USE_C99_STDINT_TR1] (unique_lock): Remove dependency on _GLIBCXX_USE_C99_STDINT_TR1. * include/c_global/cstdint [!_GLIBCXX_USE_C99_STDINT_TR1] (intmax_t) (uintmax_t): Define using predefined macros. * include/std/chrono [!_GLIBCXX_USE_C99_STDINT_TR1] (duration) (time_point, system_clock, high_resolution_clock, steady_clock): Remove dependency on _GLIBCXX_USE_C99_STDINT_TR1 macro. (nanoseconds, microseconds, milliseconds, seconds, minutes, hours): [!_GLIBCXX_USE_C99_STDINT_TR1]: Define using __INT64_TYPE__ or long long when <stdint.h> is not usable. * include/std/condition_variable [!_GLIBCXX_USE_C99_STDINT_TR1] (condition_variable, condition_variable_any): Remove dependency on _GLIBCXX_USE_C99_STDINT_TR1. * include/std/future [!_GLIBCXX_USE_C99_STDINT_TR1] (future, promise) (packaged_task, async): Likewise. * include/std/mutex [!_GLIBCXX_USE_C99_STDINT_TR1] (recursive_mutex) (timed_mutex, recursive_timed_mutex, try_lock, lock, scoped_lock) (once_flag, call_once): Likewise. * include/std/ratio [!_GLIBCXX_USE_C99_STDINT_TR1] (ratio): Likewise. * include/std/shared_mutex [!_GLIBCXX_USE_C99_STDINT_TR1] (shared_mutex, shared_timed_mutex, shared_lock): Likewise. * include/std/thread [!_GLIBCXX_USE_C99_STDINT_TR1] (thread) (this_thread::get_id, this_thread::yield, this_thread::sleep_for) (this_thread::sleep_until): Likewise. * src/c++11/chrono.cc: Remove dependency on _GLIBCXX_USE_C99_STDINT_TR1 macro. * src/c++11/condition_variable.cc: Likewise. * src/c++11/futex.cc: Likewise. * src/c++11/future.cc: Likewise. * src/c++11/mutex.cc: Likewise. * src/c++11/thread.cc: Likewise. * testsuite/20_util/duration/literals/range_neg.cc: Adjust dg-error. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise. * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Likewise. * testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise. From-SVN: r263001
2018-07-25Move std::unique_lock definition to a separate headerJonathan Wakely1-0/+1
This will allow std::mutex and std::lock_guard to be used elsewhere in the library without pulling in the whole of <chrono>. Previously the whole of <bits/std_mutex.h> was conditional on the _GLIBCXX_USE_C99_STDINT_TR1 macro, but only the std::unique_lock members that use <chrono> facilities should depend on that. std::mutex only needs to depend on _GLIBCXX_HAS_GTHREADS and std::lock_guard can be defined unconditionally. Some parts of <bits/std_mutex.h> and <mutex> are based on code in <ext/concurrence.h> which dates from 2003. However, the std::unique_lock implementation was added in 2008 by r135007, without using any earlier code. Therefore the new header file has copyright years 2008-2018. * include/Makefile.am: Add new <bits/unique_lock.h> header. * include/Makefile.in: Regenerate. * include/bits/std_mutex.h [!_GLIBCXX_USE_C99_STDINT_TR1] (mutex) (lock_guard): Define independent of _GLIBCXX_USE_C99_STDINT_TR1. (unique_lock): Move definition to ... * include/bits/unique_lock.h: New header. [!_GLIBCXX_USE_C99_STDINT_TR1] (unique_lock): Define unconditionally. [_GLIBCXX_USE_C99_STDINT_TR1] (unique_lock(mutex_type&, time_point)) (unique_lock(mutex_type&, duration), unique_lock::try_lock_until) (unique_lock::try_lock_for): Define only when <chrono> is usable. * include/std/condition_variable: Include <bits/unique_lock.h>. * include/std/mutex: Likewise. From-SVN: r262963
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-12-14PR libstdc++/68519 use native duration to avoid rounding errorsJonathan Wakely1-2/+14
PR libstdc++/68519 * include/std/condition_variable (condition_variable::wait_for): Convert duration to native clock's duration before addition. * testsuite/30_threads/condition_variable/members/68519.cc: New test. From-SVN: r255665
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-06-16Remove trailing whitespace from libstdc++ headersJonathan Wakely1-2/+2
* include/std/array: Remove trailing whitespace. * include/std/atomic: Likewise. * include/std/bitset: Likewise. * include/std/chrono: Likewise. * include/std/complex: Likewise. * include/std/condition_variable: Likewise. * include/std/fstream: Likewise. * include/std/functional: Likewise. * include/std/future: Likewise. * include/std/iomanip: Likewise. * include/std/iosfwd: Likewise. * include/std/istream: Likewise. * include/std/limits: Likewise. * include/std/ratio: Likewise. * include/std/scoped_allocator: Likewise. * include/std/sstream: Likewise. * include/std/stdexcept: Likewise. * include/std/string: Likewise. * include/std/system_error: Likewise. * include/std/thread: Likewise. * include/std/tuple: Likewise. * include/std/type_traits: Likewise. * include/std/utility: Likewise. * include/std/valarray: Likewise. * include/std/vector: Likewise. From-SVN: r237528
2016-01-06Rename bits/mutex.h to avoid clashing with glibcJonathan Wakely1-1/+1
* include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. * include/bits/mutex.h: Rename to bits/std_mutex.h. * include/std/condition_variable: Adjust include. * include/std/mutex: Likewise. From-SVN: r232101
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-09-28LWG 2135: terminate() in condition_variable::wait()Jonathan Wakely1-1/+1
* include/std/condition_variable (condition_variable::wait): Add noexcept. * src/c++11/condition_variable.cc (condition_variable::wait): Call std::terminate on error (DR 2135). From-SVN: r228217
2015-09-04Add portable timed_mutex and recursive_timed_mutex.Jonathan Wakely1-1/+1
PR libstdc++/65704 * include/Makefile.am: Add <bits/mutex.h>. * include/Makefile.in: Regenerate. * include/bits/mutex.h (__mutex_base, mutex, lock_guard, unique_lock): New file containing types moved from <mutex>. * include/std/condition_variable: Include <bits/mutex.h> instead of <mutex>. * include/std/mutex (__mutex_base, mutex, lock_guard, unique_lock): Move to <bits/mutex.h>. * testsuite/30_threads/recursive_timed_mutex/cons/1.cc: Remove dg-require-gthreads-timed. * testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/dest/ destructor_locked.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/lock/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/lock/2.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc: Likewise. * testsuite/30_threads/recursive_timed_mutex/unlock/1.cc: Likewise. * testsuite/30_threads/timed_mutex/cons/1.cc: Likewise. * testsuite/30_threads/timed_mutex/cons/assign_neg.cc: Likewise. * testsuite/30_threads/timed_mutex/cons/copy_neg.cc: Likewise. * testsuite/30_threads/timed_mutex/dest/destructor_locked.cc: Likewise. * testsuite/30_threads/timed_mutex/lock/1.cc: Likewise. * testsuite/30_threads/timed_mutex/requirements/standard_layout.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock/1.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock/2.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_for/1.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_for/2.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_for/3.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_until/1.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_until/2.cc: Likewise. * testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Likewise. * testsuite/30_threads/timed_mutex/unlock/1.cc: Likewise. * testsuite/30_threads/unique_lock/cons/5.cc: Likewise. * testsuite/30_threads/unique_lock/cons/6.cc: Likewise. * testsuite/30_threads/unique_lock/locking/3.cc: Likewise. * testsuite/30_threads/unique_lock/locking/4.cc: Likewise. From-SVN: r227490
2015-09-03Clean up libstdc++ includes slightly.Jonathan Wakely1-0/+1
* include/bits/shared_ptr_base.h: Add required header. * include/std/condition_variable: Likewise. * include/std/mutex: Remove unused header. * include/std/shared_mutex: Remove redundant header. (shared_mutex::shared_mutex()): Replace throw with __throw_bad_alloc. From-SVN: r227469
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219188
2014-12-02Define *_at_thread_exit() functions.Jonathan Wakely1-0/+9
* config/abi/pre/gnu.ver: Add new exports. * include/std/condition_variable (notify_all_at_thread_exit): Declare. (__at_thread_exit_elt): New base class. * include/std/future: Add comments documenting the implementation. (__future_base::_State_baseV2::_State_baseV2()): Use brace-or-equal initializers and define constructor as defaulted. (__future_base::_State_baseV2::_M_ready): Replace member function with member variable. (__future_base::_State_baseV2::_M_set_result): Set _M_ready. (__future_base::_State_baseV2::_M_set_delayed_result): Define. (__future_base::_State_baseV2::_M_break_promise): Set _M_ready. (__future_base::_State_baseV2::_Make_ready): New helper class. (__future_base::_Deferred_state::_M_has_deferred): Remove requirement for caller to own mutex. (__future_base::_Async_state_impl::~_Async_state_impl): Call join directly. (__future_base::_Task_state_base::_M_run): Take arguments by reference. (__future_base::_Task_state_base::_M_run_delayed): Declare new pure virtual function. (__future_base::_Task_state::_M_run_delayed): Define override. (promise::set_value_at_thread_exit): Define. (promise::set_exception_at_thread_exit): Define. (packaged_task::make_ready_at_thread_exit): Define. * src/c++11/condition_variable.cc (notify_all_at_thread_exit): Define. * src/c++11/future.cc (__future_base::_State_baseV2::_Make_ready::_M_set): Define. * testsuite/30_threads/condition_variable/members/3.cc: New. * testsuite/30_threads/packaged_task/members/at_thread_exit.cc: New. * testsuite/30_threads/promise/members/at_thread_exit.cc: New. From-SVN: r218255
2014-06-02condition_variable (condition_variable_any::_Unlock): Do not swallow ↵Jonathan Wakely1-1/+8
__forced_unwind. * include/std/condition_variable (condition_variable_any::_Unlock): Do not swallow __forced_unwind. * include/std/future (__future_base::_Task_setter): Likewise. (__future_base::_Async_state_impl): Turn __forced_unwind into broken promise and rethrow. * include/std/mutex (try_lock): Likewise. * testsuite/30_threads/async/forced_unwind.cc: New. * testsuite/30_threads/packaged_task/forced_unwind.cc: New. From-SVN: r211138
2014-01-02Update copyright years in libstdc++-v3/Richard Sandiford1-1/+1
From-SVN: r206301
2013-07-21re PR libstdc++/54352 (relaxed data race rules for ~condition_variable_any)Jonathan Wakely1-13/+23
PR libstdc++/54352 * include/std/condition_variable (condition_variable_any): Move into inline namespace _V2 and replace mutex member with shared_ptr<mutex>. * src/c++11/condition_variable.cc (condition_variable_any): Move definitions to ... * src/c++11/compatibility-condvar.cc (condition_variable_any): Here. * src/Makefile.am: Add new source file. * src/Makefile.in: Regenerate. From-SVN: r201112
2013-02-03Update copyright in libstdc++-v3.Richard Sandiford1-1/+1
From-SVN: r195701
2012-11-15re PR libstdc++/53841 ([C++11] condition_variable::wait_until() fails with ↵Jonathan Wakely1-11/+8
high resolution clocks) PR libstdc++/53841 * include/std/condition_variable (condition_variable::wait_until): Handle clocks with higher resolution than __clock_t. (condition_variable::__wait_until_impl): Remove unnecessary _Clock parameter. * testsuite/30_threads/condition_variable/members/53841.cc: New. From-SVN: r193523
2012-11-10* many: Replace uses of __GXX_EXPERIMENTAL_CXX0X__ with __cplusplus.Jason Merrill1-2/+2
From-SVN: r193392
2012-07-05* include/std/condition_variable: Update copyright years.Jonathan Wakely1-1/+1
From-SVN: r189277
2012-07-04re PR libstdc++/53830 (condition_variable_any - deadlock issue)Jonathan Wakely1-19/+27
PR libstdc++/53830 * include/std/condition_variable (condition_variable_any::wait): Move _Unlock type to class scope. (condition_variable_any::wait_until): Reuse it. * testsuite/30_threads/condition_variable_any/53830.cc: New. From-SVN: r189268
2011-10-27re PR libstdc++/50862 (deadlock in std::condition_variable_any)Jonathan Wakely1-1/+7
PR libstdc++/50862 * include/std/condition_variable (condition_variable_any::wait): Avoid terminating if relocking user mutex throws during stack-unwinding. * testsuite/30_threads/condition_variable_any/50862.cc: Add dg-require. From-SVN: r180549
2011-10-25condition_variable (condition_variable_any): Remove unused ↵Jonathan Wakely1-1/+0
native_handle_type typedef. * include/std/condition_variable (condition_variable_any): Remove unused native_handle_type typedef. * src/condition_variable.cc (condition_variable): Add missing noexcept specifications. * 30_threads/condition_variable_any/requirements/typedefs.cc: Remove. From-SVN: r180454
2011-10-25re PR libstdc++/50862 (deadlock in std::condition_variable_any)Jonathan Wakely1-8/+13
PR libstdc++/50862 * include/std/condition_variable (condition_variable_any::wait): Fix deadlock and ensure _Lock::lock() is called on exit. (condition_variable_any::native_handle): Remove, as per LWG 1500. * testsuite/30_threads/condition_variable_any/50862.cc: New. From-SVN: r180446
2011-10-25re PR libstdc++/49894 ([C++0x] Uniform initialization in constructor)Jonathan Wakely1-8/+13
PR libstdc++/49894 * include/std/mutex (__mutex_base,__recursive_mutex_base): Define new base classes to manage construction/destruction of native mutexes, using NSDMI when INIT macros are defined. (mutex,recursive_mutex,timed_mutex,recursive_timed_mutex): Derive from new base classes. * include/std/condition_variable (condition_variable): Use NSDMI when INIT macro is defined. Use noexcept. * src/condition_variable.cc (condition_variable): Explicitly-default constructor/destructor when using NSDMI. Use noexcept. (condition_variable_any): Likewise. From-SVN: r180411