[libcxx-commits] [libcxx] [libc++] Save duration/timeout locally for condition_variable waits (PR #148330)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 21 08:26:59 PDT 2025


================
@@ -188,9 +188,10 @@ public:
   _LIBCPP_HIDE_FROM_ABI cv_status wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t) {
     shared_ptr<mutex> __mut = __mut_;
     unique_lock<mutex> __lk(*__mut);
+    const chrono::time_point<_Clock, _Duration> __t_local = __t;
----------------
philnik777 wrote:

> What do you mean by "observable" here? The specification is for the call to `wait_until()` to take the timeout by-const-ref, so taking it by-value would be nonconforming.

Why? How do you observe the difference? "non-conforming" means that you somehow don't follow the standard. https://eel.is/c++draft/intro.abstract#1 gives us explicit permission to change things as long as they are not observable by users (aka the as-if rule).


https://github.com/llvm/llvm-project/pull/148330


More information about the libcxx-commits mailing list