[libcxx-commits] [PATCH] D99175: [libcxx] [test] Make the condvar wait_for tests less brittle
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 1 11:33:29 PDT 2021
mstorsjo added inline comments.
================
Comment at: libcxx/test/std/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp:54
+ d = wait_end - Clock::now();
+ if (d <= milliseconds(0)) break;
+ } while (test2 == 0 && cv.wait_for(lk, d) == std::cv_status::no_timeout);
----------------
Quuxplusone wrote:
> I instinctively object to code that produces negative durations (e.g. `milliseconds(-1)`).
> If you can show me where the standard says `milliseconds(-1)` is definitely supported, then I'll reluctantly relent — but expect me to forget that within a year and be back to my mental model that "you can't have a negative duration." :)
> With my current mental model, I'd like to see a fix where we never subtract `x - y` until we've verified that `x >= y`.
>
https://eel.is/c++draft/time.clock.system#members-1 seems to say that the `rep` type for `system_clock` is a signed type.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99175/new/
https://reviews.llvm.org/D99175
More information about the libcxx-commits
mailing list