[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 21:48:26 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:

> You're correct, my argument is purely that "the standard says it's a reference", and I assume that to be conforming it must be exactly so. Is there wording in the standard itself that allows this kind of variance? If that's the case I'd be happy to update pull request to take the parameter by-value.

Yes. As I already said, https://eel.is/c++draft/intro.abstract#1 allows for this. As long as there is no way for the user to observe the difference, it's OK.

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


More information about the libcxx-commits mailing list