kernel-posix-timers.h 1.6 KB

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