Skip to content

Commit 2e7cb8c

Browse files
author
Siva Chandra Reddy
committed
[libc] Remove references to the std threads library from __support/threads.
1 parent 8d161c1 commit 2e7cb8c

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

libc/src/__support/threads/linux/mutex.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/futex.h>
1717
#include <stdint.h>
1818
#include <sys/syscall.h> // For syscall numbers.
19-
#include <threads.h>
2019

2120
namespace __llvm_libc {
2221

@@ -55,12 +54,7 @@ struct Mutex {
5554
return MutexError::NONE;
5655
}
5756

58-
static MutexError init(mtx_t *m, bool istimed, bool isrecur, bool isrobust) {
59-
auto *mutex = reinterpret_cast<Mutex *>(m);
60-
return init(mutex, istimed, isrecur, isrobust);
61-
}
62-
63-
static MutexError destroy(mtx_t *) { return MutexError::NONE; }
57+
static MutexError destroy(Mutex *) { return MutexError::NONE; }
6458

6559
MutexError reset();
6660

libc/src/__support/threads/mutex.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ enum class MutexError : int {
5353

5454
namespace __llvm_libc {
5555

56-
static_assert(sizeof(Mutex) <= sizeof(mtx_t),
57-
"The public mtx_t type cannot accommodate the internal mutex "
58-
"type.");
59-
6056
// An RAII class for easy locking and unlocking of mutexes.
6157
class MutexLock {
6258
Mutex *mutex;

libc/src/threads/mtx_init.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@
1313

1414
namespace __llvm_libc {
1515

16+
static_assert(sizeof(Mutex) <= sizeof(mtx_t),
17+
"The public mtx_t type cannot accommodate the internal mutex "
18+
"type.");
19+
1620
LLVM_LIBC_FUNCTION(int, mtx_init, (mtx_t * m, int type)) {
17-
auto err = Mutex::init(m, type & mtx_timed, type & mtx_recursive, 0);
21+
auto err = Mutex::init(reinterpret_cast<Mutex *>(m), type & mtx_timed,
22+
type & mtx_recursive, 0);
1823
return err == MutexError::NONE ? thrd_success : thrd_error;
1924
}
2025

0 commit comments

Comments
 (0)