Commit | Line | Data |
---|---|---|
d086f507 JD |
1 | /* |
2 | * Copyright (C) 2017 - Julien Desfossez <jdesfossez@efficios.com> | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License, version 2 only, | |
6 | * as published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
11 | * more details. | |
12 | * | |
13 | * You should have received a copy of the GNU General Public License along | |
14 | * with this program; if not, write to the Free Software Foundation, Inc., | |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
16 | */ | |
17 | ||
18 | #ifndef SESSIOND_TIMER_H | |
19 | #define SESSIOND_TIMER_H | |
20 | ||
21 | #include <pthread.h> | |
22 | ||
23 | #include "session.h" | |
24 | ||
25 | #define LTTNG_SESSIOND_SIG_TEARDOWN SIGRTMIN + 10 | |
26 | #define LTTNG_SESSIOND_SIG_EXIT SIGRTMIN + 11 | |
27 | ||
28 | #define CLOCKID CLOCK_MONOTONIC | |
29 | ||
30 | /* | |
31 | * Handle timer teardown race wrt memory free of private data by sessiond | |
32 | * signals are handled by a single thread, which permits a synchronization | |
33 | * point between handling of each signal. Internal lock ensures mutual | |
34 | * exclusion. | |
35 | */ | |
36 | struct timer_signal_data { | |
37 | /* Thread managing signals. */ | |
38 | pthread_t tid; | |
39 | int qs_done; | |
40 | pthread_mutex_t lock; | |
41 | }; | |
42 | ||
43 | struct timer_thread_parameters { | |
44 | struct rotation_thread_timer_queue *rotation_timer_queue; | |
45 | }; | |
46 | ||
47 | struct sessiond_rotation_timer { | |
48 | uint64_t session_id; | |
49 | unsigned int signal; | |
50 | /* List member in struct rotation_thread_timer_queue. */ | |
51 | struct cds_list_head head; | |
52 | }; | |
53 | ||
54 | void *sessiond_timer_thread(void *data); | |
55 | int sessiond_timer_signal_init(void); | |
56 | ||
57 | #endif /* SESSIOND_TIMER_H */ |