xref: /llvm-project/libc/src/threads/thrd_exit.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
10071a795SSiva Chandra Reddy //===-- Linux implementation of the thrd_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 "src/threads/thrd_exit.h"
100071a795SSiva Chandra Reddy #include "src/__support/common.h"
11*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
120071a795SSiva Chandra Reddy #include "src/__support/threads/thread.h"
130071a795SSiva Chandra Reddy 
140071a795SSiva Chandra Reddy #include <threads.h> // For thrd_* type definitions.
150071a795SSiva Chandra Reddy 
16*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
170071a795SSiva Chandra Reddy 
18b6bc9d72SGuillaume Chatelet static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread),
190071a795SSiva Chandra Reddy               "Mismatch between thrd_t and internal Thread.");
200071a795SSiva Chandra Reddy 
210071a795SSiva Chandra Reddy LLVM_LIBC_FUNCTION(void, thrd_exit, (int retval)) {
220071a795SSiva Chandra Reddy   thread_exit(ThreadReturnValue(retval), ThreadStyle::STDC);
230071a795SSiva Chandra Reddy }
240071a795SSiva Chandra Reddy 
25*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
26