diff options
Diffstat (limited to 'libc/include')
-rw-r--r-- | libc/include/CMakeLists.txt | 2 | ||||
-rw-r--r-- | libc/include/llvm-libc-types/CMakeLists.txt | 2 | ||||
-rw-r--r-- | libc/include/llvm-libc-types/__pthread_once_func_t.h | 14 | ||||
-rw-r--r-- | libc/include/llvm-libc-types/pthread_once_t.h | 20 | ||||
-rw-r--r-- | libc/include/pthread.h.def | 2 |
5 files changed, 40 insertions, 0 deletions
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index a8aac4cfbd31..e8db6b72df70 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -188,6 +188,8 @@ add_gen_header( .llvm-libc-types.pthread_key_t .llvm-libc-types.pthread_mutex_t .llvm-libc-types.pthread_mutexattr_t + .llvm-libc-types.pthread_once_t + .llvm-libc-types.__pthread_once_func_t .llvm-libc-types.pthread_t ) diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index 5fde05a3665a..5f0a5796042c 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -4,6 +4,7 @@ add_header(__bsearchcompare_t HDR __bsearchcompare_t.h) add_header(__call_once_func_t HDR __call_once_func_t.h) add_header(__futex_word HDR __futex_word.h) add_header(__mutex_type HDR __mutex_type.h DEPENDS .__futex_word) +add_header(__pthread_once_func_t HDR __pthread_once_func_t.h) add_header(__pthread_start_t HDR __pthread_start_t.h) add_header(__pthread_tss_dtor_t HDR __pthread_tss_dtor_t.h) add_header(__qsortcompare_t HDR __qsortcompare_t.h) @@ -38,6 +39,7 @@ add_header(pthread_key_t HDR pthread_key_t.h) add_header(pthread_mutex_t HDR pthread_mutex_t.h DEPENDS .__futex_word .__mutex_type) add_header(pthread_t HDR pthread_t.h DEPENDS .__thread_type) add_header(pthread_mutexattr_t HDR pthread_mutexattr_t.h) +add_header(pthread_once_t HDR pthread_once_t.h DEPENDS .__futex_word) add_header(rlim_t HDR rlim_t.h) add_header(struct_rlimit HDR struct_rlimit.h DEPENDS .rlim_t) add_header(ssize_t HDR ssize_t.h) diff --git a/libc/include/llvm-libc-types/__pthread_once_func_t.h b/libc/include/llvm-libc-types/__pthread_once_func_t.h new file mode 100644 index 000000000000..5ace5cb7f151 --- /dev/null +++ b/libc/include/llvm-libc-types/__pthread_once_func_t.h @@ -0,0 +1,14 @@ +//===-- Definition of __pthread_once_func_t type --------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef __LLVM_LIBC_TYPES_PTHREAD_ONCE_FUNC_T_H__ +#define __LLVM_LIBC_TYPES_PTHREAD_ONCE_FUNC_T_H__ + +typedef void (*__pthread_once_func_t)(void); + +#endif // __LLVM_LIBC_TYPES_PTHREAD_ONCE_FUNC_T_H__ diff --git a/libc/include/llvm-libc-types/pthread_once_t.h b/libc/include/llvm-libc-types/pthread_once_t.h new file mode 100644 index 000000000000..be5c139d0c0e --- /dev/null +++ b/libc/include/llvm-libc-types/pthread_once_t.h @@ -0,0 +1,20 @@ +//===-- Definition of pthread_once_t type ---------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef __LLVM_LIBC_TYPES_PTHREAD_ONCE_T_H__ +#define __LLVM_LIBC_TYPES_PTHREAD_ONCE_T_H__ + +#include <llvm-libc-types/__futex_word.h> + +#ifdef __unix__ +typedef __futex_word pthread_once_t; +#else +#error "Once flag type not defined for the target platform." +#endif + +#endif // __LLVM_LIBC_TYPES_PTHREAD_ONCE_T_H__ diff --git a/libc/include/pthread.h.def b/libc/include/pthread.h.def index 60f257e7078d..18352c053938 100644 --- a/libc/include/pthread.h.def +++ b/libc/include/pthread.h.def @@ -13,6 +13,8 @@ #define PTHREAD_STACK_MIN (1 << 14) // 16KB +#define PTHREAD_ONCE_INIT {0} + enum { PTHREAD_CREATE_JOINABLE = 0x0, PTHREAD_CREATE_DETACHED = 0x1, |