Add C11 call_once() support to go with C11 threads and mutexes. Signed-off-by: Christopher Friedt <cfriedt@meta.com>
33 lines
765 B
C
33 lines
765 B
C
/*
|
|
* Copyright (c) 2023, Meta
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef ZEPHYR_LIB_LIBC_COMMON_INCLUDE_MACHINE__THREADS_H_
|
|
#define ZEPHYR_LIB_LIBC_COMMON_INCLUDE_MACHINE__THREADS_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define ONCE_FLAG_INIT \
|
|
{ \
|
|
1, 0 \
|
|
}
|
|
|
|
typedef int cnd_t;
|
|
typedef int mtx_t;
|
|
typedef int thrd_t;
|
|
typedef int tss_t;
|
|
typedef struct {
|
|
int is_initialized;
|
|
int init_executed;
|
|
} once_flag;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ZEPHYR_LIB_LIBC_COMMON_INCLUDE_MACHINE__THREADS_H_ */
|