blob: f8bfdc2ae556ccbf51dc5c8c61b8a723caf32ecf [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
2 * kernel-posix-timers.h - kernel-dependent definitions for POSIX timers.
3 */
4
5#include <features.h>
6#include <setjmp.h>
7#include <signal.h>
8#include <sys/types.h>
9#ifdef __UCLIBC_HAS_THREADS__
10#include <pthread.h>
11#endif
12
13#ifdef __UCLIBC_HAS_THREADS_NATIVE__
14/* Nonzero if the system calls are not available. */
15extern int __no_posix_timers attribute_hidden;
16
17/* Callback to start helper thread. */
18extern void __start_helper_thread (void) attribute_hidden;
19
20/* Control variable for helper thread creation. */
21extern pthread_once_t __helper_once attribute_hidden;
22
23/* TID of the helper thread. */
24extern pid_t __helper_tid attribute_hidden;
25
26/* List of active SIGEV_THREAD timers. */
27extern struct timer *__active_timer_sigev_thread attribute_hidden;
28/* Lock for the __active_timer_sigev_thread. */
29extern pthread_mutex_t __active_timer_sigev_thread_lock attribute_hidden;
30#endif
31
32/* Type of timers in the kernel */
33typedef int kernel_timer_t;
34
35/* Internal representation of timer */
36struct timer {
37 /* Notification mechanism */
38 int sigev_notify;
39
40 /* Timer ID returned by the kernel */
41 kernel_timer_t ktimerid;
42
43 /*
44 * All new elements must be added after ktimerid. And if the thrfunc
45 * element is not the third element anymore the memory allocation in
46 * timer_create needs to be changed.
47 */
48
49 /* Parameters for the thread to be started for SIGEV_THREAD */
50 void (*thrfunc) (sigval_t);
51 sigval_t sival;
52#ifdef __UCLIBC_HAS_THREADS__
53 pthread_attr_t attr;
54#endif
55
56 /* Next element in list of active SIGEV_THREAD timers. */
57 struct timer *next;
58};