[libcxx-commits] [PATCH] D64378: [libcxx] Use C11 thread API on Fuchsia

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 30 11:17:41 PDT 2019


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

LGTM apart from inline comments.



================
Comment at: libcxx/include/__threading_support:83
+typedef mtx_t __libcpp_mutex_t;
+#define _LIBCPP_MUTEX_INITIALIZER {}
+
----------------
Could we add a comment explaining why we think using `{}` is safe here? So we don't have to do the archaeology in the future.


================
Comment at: libcxx/include/__threading_support:505
+                          void (*init_routine)(void)) {
+  call_once(flag, init_routine);
+  return 0;
----------------
There is a `std::call_once`, should this be qualified as `::call_once`?


================
Comment at: libcxx/include/__threading_support:562
+  seconds __s = duration_cast<seconds>(__ns);
+  timespec __ts;
+  typedef decltype(__ts.tv_sec) ts_sec;
----------------
This code is duplicated from the `pthread` version, right? Could we generalize the "convert chrono duration to a timespec like thing", and de-duplicate it?


================
Comment at: libcxx/include/__threading_support:563
+  timespec __ts;
+  typedef decltype(__ts.tv_sec) ts_sec;
+  const ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
----------------
`ts_sec` needs a reserved name.


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D64378





More information about the libcxx-commits mailing list