|
Packit |
6c4009 |
/* Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public License as
|
|
Packit |
6c4009 |
published by the Free Software Foundation; either version 2.1 of the
|
|
Packit |
6c4009 |
License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; see the file COPYING.LIB. If
|
|
Packit |
6c4009 |
not, see <http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <pthread.h>
|
|
Packit |
6c4009 |
#include <setjmp.h>
|
|
Packit |
6c4009 |
#include <signal.h>
|
|
Packit |
6c4009 |
#include <sys/types.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Nonzero if the system calls are not available. */
|
|
Packit |
6c4009 |
extern int __no_posix_timers attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Callback to start helper thread. */
|
|
Packit |
6c4009 |
extern void __start_helper_thread (void) attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Control variable for helper thread creation. */
|
|
Packit |
6c4009 |
extern pthread_once_t __helper_once attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* TID of the helper thread. */
|
|
Packit |
6c4009 |
extern pid_t __helper_tid attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* List of active SIGEV_THREAD timers. */
|
|
Packit |
6c4009 |
extern struct timer *__active_timer_sigev_thread attribute_hidden;
|
|
Packit |
6c4009 |
/* Lock for the __active_timer_sigev_thread. */
|
|
Packit |
6c4009 |
extern pthread_mutex_t __active_timer_sigev_thread_lock attribute_hidden;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Type of timers in the kernel. */
|
|
Packit |
6c4009 |
typedef int kernel_timer_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Internal representation of timer. */
|
|
Packit |
6c4009 |
struct timer
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* Notification mechanism. */
|
|
Packit |
6c4009 |
int sigev_notify;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Timer ID returned by the kernel. */
|
|
Packit |
6c4009 |
kernel_timer_t ktimerid;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* All new elements must be added after ktimerid. And if the thrfunc
|
|
Packit |
6c4009 |
element is not the third element anymore the memory allocation in
|
|
Packit |
6c4009 |
timer_create needs to be changed. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Parameters for the thread to be started for SIGEV_THREAD. */
|
|
Packit |
6c4009 |
void (*thrfunc) (sigval_t);
|
|
Packit |
6c4009 |
sigval_t sival;
|
|
Packit |
6c4009 |
pthread_attr_t attr;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Next element in list of active SIGEV_THREAD timers. */
|
|
Packit |
6c4009 |
struct timer *next;
|
|
Packit |
6c4009 |
};
|