[libcxx-commits] [PATCH] D65339: Implement std::condition_variable via pthread_cond_clockwait() where available

Tom via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 26 12:24:01 PDT 2019


tomcherry marked 3 inline comments as done.
tomcherry added a comment.

> So, to make sure I understand, this patch uses something that is *not yet* in POSIX, it's only proposed, correct?

Correct.  I updated the commit message to clarify that it's only proposed.



================
Comment at: include/__mutex_base:397
+condition_variable::wait_until(unique_lock<mutex>& __lk,
+                               const chrono::time_point<_Clock, _Duration>& __t)
+{
----------------
ldionne wrote:
> Can't you just overload on `chrono::time_point<chrono::system_clock, _Duration>&` and avoid the `enable_if` dance?
Thanks, yes, the new patch simplifies all of this.


================
Comment at: include/__mutex_base:528
+    nanoseconds d = tp.time_since_epoch();
+    if (d > nanoseconds(0x59682F000000E941))
+        d = nanoseconds(0x59682F000000E941);
----------------
ldionne wrote:
> Please pardon my naiveness, but what is that number?
It's taken from condition_variable.cpp, added in https://reviews.llvm.org/rGaad745a024a3d0fd573ac9649d4c659e6a713702.  

I tried to keep all of the safety checks around chrono intact.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65339/new/

https://reviews.llvm.org/D65339





More information about the libcxx-commits mailing list