1 //===-- Linux implementation of the mtx_init function ---------------------===//
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 "include/threads.h" // For mtx_t definition.
10 #include "src/__support/common.h"
11 #include "src/threads/linux/thread_utils.h"
12 
13 namespace __llvm_libc {
14 
LLVM_LIBC_ENTRYPOINT(mtx_init)15 int LLVM_LIBC_ENTRYPOINT(mtx_init)(mtx_t *mutex, int type) {
16   *(reinterpret_cast<uint32_t *>(mutex->__internal_data)) = MS_Free;
17   mutex->__mtx_type = type;
18   return thrd_success;
19 }
20 
21 } // namespace __llvm_libc
22