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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 18 11:01:27 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;
----------------
ldionne wrote:

This is indeed a bug right now. I wonder if maybe it would be conforming to change `wait_until` to take by value today, without waiting for the Standard to say so. I think it might be conforming, assuming there is no way for that change to be observable (and I don't see how taking by value instead of `const&` is observable).

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


More information about the libcxx-commits mailing list