xref: /llvm-project/libc/src/pthread/pthread_exit.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
10071a795SSiva Chandra Reddy //===-- Implementation of the pthread_exit function -----------------------===//
20071a795SSiva Chandra Reddy //
30071a795SSiva Chandra Reddy // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40071a795SSiva Chandra Reddy // See https://llvm.org/LICENSE.txt for license information.
50071a795SSiva Chandra Reddy // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60071a795SSiva Chandra Reddy //
70071a795SSiva Chandra Reddy //===----------------------------------------------------------------------===//
80071a795SSiva Chandra Reddy 
90071a795SSiva Chandra Reddy #include "pthread_exit.h"
100071a795SSiva Chandra Reddy 
110071a795SSiva Chandra Reddy #include "src/__support/common.h"
12*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
130071a795SSiva Chandra Reddy #include "src/__support/threads/thread.h"
140071a795SSiva Chandra Reddy 
150071a795SSiva Chandra Reddy #include <pthread.h> // For pthread_* type definitions.
160071a795SSiva Chandra Reddy 
17*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
180071a795SSiva Chandra Reddy 
19b6bc9d72SGuillaume Chatelet static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread),
200071a795SSiva Chandra Reddy               "Mismatch between pthread_t and internal Thread.");
210071a795SSiva Chandra Reddy 
220071a795SSiva Chandra Reddy LLVM_LIBC_FUNCTION(void, pthread_exit, (void *retval)) {
23b6bc9d72SGuillaume Chatelet   LIBC_NAMESPACE::thread_exit(ThreadReturnValue(retval), ThreadStyle::POSIX);
240071a795SSiva Chandra Reddy }
250071a795SSiva Chandra Reddy 
26*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
27