1 /* 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. */ 15 extern int __no_posix_timers attribute_hidden; 16 17 /* Callback to start helper thread. */ 18 extern void __start_helper_thread (void) attribute_hidden; 19 20 /* Control variable for helper thread creation. */ 21 extern pthread_once_t __helper_once attribute_hidden; 22 23 /* TID of the helper thread. */ 24 extern pid_t __helper_tid attribute_hidden; 25 26 /* List of active SIGEV_THREAD timers. */ 27 extern struct timer *__active_timer_sigev_thread attribute_hidden; 28 /* Lock for the __active_timer_sigev_thread. */ 29 extern pthread_mutex_t __active_timer_sigev_thread_lock attribute_hidden; 30 #endif 31 32 /* Type of timers in the kernel */ 33 typedef int kernel_timer_t; 34 35 /* Internal representation of timer */ 36 struct 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 }; 59