[libcxx-commits] [PATCH] D98015: [libcxx] Simplify rounding of durations in win32 __libcpp_thread_sleep_for

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 16 12:41:55 PDT 2021

Mordante accepted this revision.
Mordante added a comment.
This revision is now accepted and ready to land.

LGTM except a minor issue.

Comment at: libcxx/src/support/win32/thread_win32.cpp:250
+  // round-up to the nearest millisecond
+  chrono::milliseconds __ms = std::chrono::ceil<chrono::milliseconds>(__ns);
   // FIXME(compnerd) this should be an alertable sleep (WFSO or SleepEx)
curdeius wrote:
> mstorsjo wrote:
> > curdeius wrote:
> > > Just a remark, not specific to this patch.
> > > It seems that in `src/` we sometimes use `_VSTD::` and sometimes `std::`, which is pretty much inconsistent.
> > > IMO, we should use `_VSTD::` as much as possible.
> > Hmm, right. Would that also go for the references within `_LIBCPP_SEMAPHORE_MAX` as discussed in https://reviews.llvm.org/D97539#inline-919370?
> > 
> > I'm not entirely sure about the use of `_VSTD::`, but my impression is that it would matter most within headers (where users of the library could redirect things or something like that), while the implementation in `src/` mostly is fixed anyway?
> Yes, indeed, it doesn't change much in `src`. As I said, we're just inconsistent.
> For the macros, as in D97539, I don't know really, we have both.
I think we should use `std::` in the `src` directory. For consistency I'd like to remove the `std::` here. The function argument also uses `chrono` instead of `std::chrono`. Maybe also adjust `__libcpp_semaphore_wait_timed` so they are similar.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list