18dc42802SSiva Chandra Reddy //===-- Implementation of the thrd_current function -----------------------===// 28dc42802SSiva Chandra Reddy // 38dc42802SSiva Chandra Reddy // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 48dc42802SSiva Chandra Reddy // See https://llvm.org/LICENSE.txt for license information. 58dc42802SSiva Chandra Reddy // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 68dc42802SSiva Chandra Reddy // 78dc42802SSiva Chandra Reddy //===----------------------------------------------------------------------===// 88dc42802SSiva Chandra Reddy 98dc42802SSiva Chandra Reddy #include "src/threads/thrd_current.h" 108dc42802SSiva Chandra Reddy #include "src/__support/common.h" 11*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h" 128dc42802SSiva Chandra Reddy #include "src/__support/threads/thread.h" 138dc42802SSiva Chandra Reddy 148dc42802SSiva Chandra Reddy #include <threads.h> // For thrd_* type definitions. 158dc42802SSiva Chandra Reddy 16*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL { 178dc42802SSiva Chandra Reddy 18b6bc9d72SGuillaume Chatelet static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), 198dc42802SSiva Chandra Reddy "Mismatch between thrd_t and internal Thread."); 208dc42802SSiva Chandra Reddy 218dc42802SSiva Chandra Reddy LLVM_LIBC_FUNCTION(thrd_t, thrd_current, ()) { 228dc42802SSiva Chandra Reddy thrd_t th; 238dc42802SSiva Chandra Reddy th.__attrib = self.attrib; 248dc42802SSiva Chandra Reddy return th; 258dc42802SSiva Chandra Reddy } 268dc42802SSiva Chandra Reddy 27*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 28