[libc-commits] [libc] [libc][__support] move CndVar to __support (PR #89329)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Apr 23 12:48:45 PDT 2024


================
@@ -6,16 +6,19 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "CndVar.h"
-
 #include "src/threads/cnd_broadcast.h"
 #include "src/__support/common.h"
+#include "src/__support/threads/CndVar.h"
+
+#include <threads.h> // cnd_t, thrd_error, thrd_success
 
 namespace LIBC_NAMESPACE {
 
+static_assert(sizeof(CndVar) == sizeof(cnd_t));
+
 LLVM_LIBC_FUNCTION(int, cnd_broadcast, (cnd_t * cond)) {
   CndVar *cndvar = reinterpret_cast<CndVar *>(cond);
-  return cndvar->broadcast();
+  return cndvar->broadcast() ? thrd_error : thrd_success;
----------------
michaelrj-google wrote:

the way it's currently implemented, `cndvar->broadcast()` can only return 0. This extra condition is unnecessary.

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


More information about the libc-commits mailing list