[libc] Remove references to the std threads library from __support/threads.
authorSiva Chandra Reddy <sivachandra@google.com>
Wed, 16 Mar 2022 19:33:01 +0000 (19:33 +0000)
committerSiva Chandra Reddy <sivachandra@google.com>
Wed, 16 Mar 2022 19:35:40 +0000 (19:35 +0000)
libc/src/__support/threads/linux/mutex.h
libc/src/__support/threads/mutex.h
libc/src/threads/mtx_init.cpp

index 00af4a2..e4e06e9 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/futex.h>
 #include <stdint.h>
 #include <sys/syscall.h> // For syscall numbers.
-#include <threads.h>
 
 namespace __llvm_libc {
 
@@ -55,12 +54,7 @@ public:
     return MutexError::NONE;
   }
 
-  static MutexError init(mtx_t *m, bool istimed, bool isrecur, bool isrobust) {
-    auto *mutex = reinterpret_cast<Mutex *>(m);
-    return init(mutex, istimed, isrecur, isrobust);
-  }
-
-  static MutexError destroy(mtx_t *) { return MutexError::NONE; }
+  static MutexError destroy(Mutex *) { return MutexError::NONE; }
 
   MutexError reset();
 
index e717038..f585dcd 100644 (file)
@@ -53,10 +53,6 @@ enum class MutexError : int {
 
 namespace __llvm_libc {
 
-static_assert(sizeof(Mutex) <= sizeof(mtx_t),
-              "The public mtx_t type cannot accommodate the internal mutex "
-              "type.");
-
 // An RAII class for easy locking and unlocking of mutexes.
 class MutexLock {
   Mutex *mutex;
index f3d1ee6..1e4da79 100644 (file)
 
 namespace __llvm_libc {
 
+static_assert(sizeof(Mutex) <= sizeof(mtx_t),
+              "The public mtx_t type cannot accommodate the internal mutex "
+              "type.");
+
 LLVM_LIBC_FUNCTION(int, mtx_init, (mtx_t * m, int type)) {
-  auto err = Mutex::init(m, type & mtx_timed, type & mtx_recursive, 0);
+  auto err = Mutex::init(reinterpret_cast<Mutex *>(m), type & mtx_timed,
+                         type & mtx_recursive, 0);
   return err == MutexError::NONE ? thrd_success : thrd_error;
 }