| 1 | //===-- Implementation of the tss_create ----------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "tss_create.h" |
| 10 | |
| 11 | #include "src/__support/common.h" |
| 12 | #include "src/__support/macros/config.h" |
| 13 | #include "src/__support/threads/thread.h" |
| 14 | |
| 15 | #include <threads.h> |
| 16 | |
| 17 | namespace LIBC_NAMESPACE_DECL { |
| 18 | |
| 19 | LLVM_LIBC_FUNCTION(int, tss_create, (tss_t * key, tss_dtor_t dtor)) { |
| 20 | auto k = LIBC_NAMESPACE::new_tss_key(dtor); |
| 21 | if (!k) |
| 22 | return thrd_error; |
| 23 | *key = *k; |
| 24 | return thrd_success; |
| 25 | } |
| 26 | |
| 27 | } // namespace LIBC_NAMESPACE_DECL |
| 28 | |