GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++

Libstdc++: Implement LWG 4301 for condition_variable.

Updates condition_variable wait methods to take timeout parameters by value, per LWG 4301.

The wait_until and wait_for methods for std::condition_variable and std::condition_variable_any in libstdc++ have been updated to accept their timeout parameters by value. This change aligns the implementation with the resolution of Library Working Group (LWG) issue 4301, ensuring consistent behavior across different C++ standard library implementations.

In Details

The timeout parameters for condition_variable::wait_until, condition_variable::wait_for, condition_variable_any::wait_until, and condition_variable_any::wait_for (and their internal implementations) in libstdc++ have been changed to be passed by value. This addresses LWG 4301, which specified that these parameters should be passed by value rather than by reference, improving the correctness and consistency of the condition variable implementation.

For Context
libstdc++
The C++ standard library implementation used by GCC.
condition_variable
A C++ synchronization primitive that allows threads to wait until a certain condition becomes true.
condition_variable_any
An extension of std::condition_variable that can be used with any type of lock, not just std::unique_lock.
LWG
Library Working Group, a committee within the C++ Standards Committee responsible for the C++ Standard Library.
timeout parameter
A parameter that specifies a maximum duration to wait for an operation before giving up.
Filed Under: libstdc++concurrencystandard library