Back to index

glibc  2.9
kernel-posix-timers.h
Go to the documentation of this file.
00001 /* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public License as
00007    published by the Free Software Foundation; either version 2.1 of the
00008    License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00017    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.  */
00019 
00020 #include <pthread.h>
00021 #include <setjmp.h>
00022 #include <signal.h>
00023 #include <sys/types.h>
00024 
00025 
00026 /* Nonzero if the system calls are not available.  */
00027 extern int __no_posix_timers attribute_hidden;
00028 
00029 /* Callback to start helper thread.  */
00030 extern void __start_helper_thread (void) attribute_hidden;
00031 
00032 /* Control variable for helper thread creation.  */
00033 extern pthread_once_t __helper_once attribute_hidden;
00034 
00035 /* TID of the helper thread.  */
00036 extern pid_t __helper_tid attribute_hidden;
00037 
00038 /* List of active SIGEV_THREAD timers.  */
00039 extern struct timer *__active_timer_sigev_thread attribute_hidden;
00040 /* Lock for the __active_timer_sigev_thread.  */
00041 extern pthread_mutex_t __active_timer_sigev_thread_lock attribute_hidden;
00042 
00043 
00044 /* Type of timers in the kernel.  */
00045 typedef int kernel_timer_t;
00046 
00047 
00048 /* Internal representation of timer.  */
00049 struct timer
00050 {
00051   /* Notification mechanism.  */
00052   int sigev_notify;
00053 
00054   /* Timer ID returned by the kernel.  */
00055   kernel_timer_t ktimerid;
00056 
00057   /* All new elements must be added after ktimerid.  And if the thrfunc
00058      element is not the third element anymore the memory allocation in
00059      timer_create needs to be changed.  */
00060 
00061   /* Parameters for the thread to be started for SIGEV_THREAD.  */
00062   void (*thrfunc) (sigval_t);
00063   sigval_t sival;
00064   pthread_attr_t attr;
00065 
00066   /* Next element in list of active SIGEV_THREAD timers.  */
00067   struct timer *next;
00068 };