aboutsummaryrefslogtreecommitdiff
path: root/libc/src/pthread
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2022-06-23 18:18:50 +0000
committerSiva Chandra Reddy <sivachandra@google.com>2022-06-24 08:22:53 +0000
commitf4580c6d5a44379f3b1be033f39ec7af78dbbbfa (patch)
treef752af3d381abea1fd73fe38a903c54e4d93ff2d /libc/src/pthread
parent2b3de2971790964691b351cc068f936eeeea32a4 (diff)
downloadllvm-f4580c6d5a44379f3b1be033f39ec7af78dbbbfa.zip
llvm-f4580c6d5a44379f3b1be033f39ec7af78dbbbfa.tar.gz
llvm-f4580c6d5a44379f3b1be033f39ec7af78dbbbfa.tar.bz2
[libc][NFC] Remove the templatization from the linux implementation of thread.
This enables setting up a single "self" thread object to be returned by API like thrd_self and pthread_self.
Diffstat (limited to 'libc/src/pthread')
-rw-r--r--libc/src/pthread/pthread_create.cpp6
-rw-r--r--libc/src/pthread/pthread_detach.cpp6
-rw-r--r--libc/src/pthread/pthread_join.cpp6
3 files changed, 9 insertions, 9 deletions
diff --git a/libc/src/pthread/pthread_create.cpp b/libc/src/pthread/pthread_create.cpp
index bc945a9..ec1e0e3 100644
--- a/libc/src/pthread/pthread_create.cpp
+++ b/libc/src/pthread/pthread_create.cpp
@@ -16,14 +16,14 @@
namespace __llvm_libc {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread<int>),
- "Mismatch between pthread_t and internal Thread<int>.");
+static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+ "Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, pthread_create,
(pthread_t *__restrict th,
const pthread_attr_t *__restrict attr,
__pthread_start_t func, void *arg)) {
- auto *thread = reinterpret_cast<__llvm_libc::Thread<void *> *>(th);
+ auto *thread = reinterpret_cast<__llvm_libc::Thread *>(th);
int result = thread->run(func, arg, nullptr, 0);
if (result != 0 && result != EPERM)
return EAGAIN;
diff --git a/libc/src/pthread/pthread_detach.cpp b/libc/src/pthread/pthread_detach.cpp
index c71b12f..009438e 100644
--- a/libc/src/pthread/pthread_detach.cpp
+++ b/libc/src/pthread/pthread_detach.cpp
@@ -15,11 +15,11 @@
namespace __llvm_libc {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread<void *>),
- "Mismatch between pthread_t and internal Thread<void *>.");
+static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+ "Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, pthread_detach, (pthread_t th)) {
- auto *thread = reinterpret_cast<Thread<void *> *>(&th);
+ auto *thread = reinterpret_cast<Thread *>(&th);
thread->detach();
return 0;
}
diff --git a/libc/src/pthread/pthread_join.cpp b/libc/src/pthread/pthread_join.cpp
index c3bf4ad..0774d02 100644
--- a/libc/src/pthread/pthread_join.cpp
+++ b/libc/src/pthread/pthread_join.cpp
@@ -15,11 +15,11 @@
namespace __llvm_libc {
-static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread<int>),
- "Mismatch between pthread_t and internal Thread<int>.");
+static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread),
+ "Mismatch between pthread_t and internal Thread.");
LLVM_LIBC_FUNCTION(int, pthread_join, (pthread_t th, void **retval)) {
- auto *thread = reinterpret_cast<Thread<void *> *>(&th);
+ auto *thread = reinterpret_cast<Thread *>(&th);
int result = thread->join(retval);
return result;
}