kernel-posix-timers.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Copyright (C) 2003-2019 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public License as
  6. published by the Free Software Foundation; either version 2.1 of the
  7. License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; see the file COPYING.LIB. If
  14. not, see <http://www.gnu.org/licenses/>. */
  15. #include <pthread.h>
  16. #include <setjmp.h>
  17. #include <signal.h>
  18. #include <sys/types.h>
  19. /* Nonzero if the system calls are not available. */
  20. extern int __no_posix_timers attribute_hidden;
  21. /* Callback to start helper thread. */
  22. extern void __start_helper_thread (void) attribute_hidden;
  23. /* Control variable for helper thread creation. */
  24. extern pthread_once_t __helper_once attribute_hidden;
  25. /* TID of the helper thread. */
  26. extern pid_t __helper_tid attribute_hidden;
  27. /* List of active SIGEV_THREAD timers. */
  28. extern struct timer *__active_timer_sigev_thread attribute_hidden;
  29. /* Lock for the __active_timer_sigev_thread. */
  30. extern pthread_mutex_t __active_timer_sigev_thread_lock attribute_hidden;
  31. /* Type of timers in the kernel. */
  32. typedef int kernel_timer_t;
  33. /* Internal representation of timer. */
  34. struct timer
  35. {
  36. /* Notification mechanism. */
  37. int sigev_notify;
  38. /* Timer ID returned by the kernel. */
  39. kernel_timer_t ktimerid;
  40. /* All new elements must be added after ktimerid. And if the thrfunc
  41. element is not the third element anymore the memory allocation in
  42. timer_create needs to be changed. */
  43. /* Parameters for the thread to be started for SIGEV_THREAD. */
  44. void (*thrfunc) (sigval_t);
  45. sigval_t sival;
  46. pthread_attr_t attr;
  47. /* Next element in list of active SIGEV_THREAD timers. */
  48. struct timer *next;
  49. };