Elliott Hughes | 13da600 | 2025-02-03 10:42:13 -0800 | [diff] [blame] | 1 | // Copyright (C) 2019 The Android Open Source Project |
| 2 | // SPDX-License-Identifier: BSD-2-Clause |
Elliott Hughes | 4206711 | 2019-04-18 14:27:24 -0700 | [diff] [blame] | 3 | |
| 4 | #if __has_include(<threads.h>) |
| 5 | |
| 6 | #include <threads.h> |
| 7 | |
| 8 | #include "header_checks.h" |
| 9 | |
| 10 | thread_local int t; |
| 11 | |
| 12 | static void threads_h() { |
| 13 | MACRO(ONCE_FLAG_INIT); |
| 14 | MACRO(TSS_DTOR_ITERATIONS); |
| 15 | |
| 16 | TYPE(cnd_t); |
| 17 | TYPE(thrd_t); |
| 18 | TYPE(tss_t); |
| 19 | TYPE(mtx_t); |
| 20 | |
| 21 | TYPE(tss_dtor_t); |
| 22 | TYPE(thrd_start_t); |
| 23 | |
| 24 | TYPE(once_flag); |
| 25 | |
| 26 | int enumeration_constants = mtx_plain | mtx_recursive | mtx_timed | |
| 27 | thrd_timedout | thrd_success | thrd_busy | thrd_error | thrd_nomem; |
| 28 | |
| 29 | FUNCTION(call_once, void (*f)(once_flag*, void (*)(void))); |
| 30 | |
| 31 | FUNCTION(cnd_broadcast, int (*f)(cnd_t*)); |
| 32 | FUNCTION(cnd_destroy, void (*f)(cnd_t*)); |
| 33 | FUNCTION(cnd_init, int (*f)(cnd_t*)); |
| 34 | FUNCTION(cnd_signal, int (*f)(cnd_t*)); |
| 35 | FUNCTION(cnd_timedwait, int (*f)(cnd_t*, mtx_t*, const struct timespec*)); |
| 36 | FUNCTION(cnd_wait, int (*f)(cnd_t*, mtx_t*)); |
| 37 | |
| 38 | FUNCTION(mtx_destroy, void (*f)(mtx_t*)); |
| 39 | FUNCTION(mtx_init, int (*f)(mtx_t*, int)); |
| 40 | FUNCTION(mtx_lock, int (*f)(mtx_t*)); |
| 41 | FUNCTION(mtx_timedlock, int (*f)(mtx_t*, const struct timespec*)); |
| 42 | FUNCTION(mtx_trylock, int (*f)(mtx_t*)); |
| 43 | FUNCTION(mtx_unlock, int (*f)(mtx_t*)); |
| 44 | |
| 45 | FUNCTION(thrd_create, int (*f)(thrd_t*, thrd_start_t, void*)); |
| 46 | FUNCTION(thrd_current, thrd_t (*f)(void)); |
| 47 | FUNCTION(thrd_detach, int (*f)(thrd_t)); |
| 48 | FUNCTION(thrd_equal, int (*f)(thrd_t, thrd_t)); |
| 49 | FUNCTION(thrd_exit, void (*f)(int)); |
| 50 | FUNCTION(thrd_join, int (*f)(thrd_t, int*)); |
| 51 | FUNCTION(thrd_sleep, int (*f)(const struct timespec*, struct timespec*)); |
| 52 | FUNCTION(thrd_yield, void (*f)(void)); |
| 53 | |
| 54 | FUNCTION(tss_create, int (*f)(tss_t*, tss_dtor_t)); |
| 55 | FUNCTION(tss_delete, void (*f)(tss_t)); |
| 56 | FUNCTION(tss_get, void* (*f)(tss_t)); |
| 57 | FUNCTION(tss_set, int (*f)(tss_t, void*)); |
| 58 | } |
| 59 | |
| 60 | #define DO_NOT_INCLUDE_TIME_H |
| 61 | #include "time_h.c" |
| 62 | |
| 63 | #endif |