Commit | Line | Data |
---|---|---|
db66e574 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 it | |
5 | * under the terms of the GNU General Public License, version 2 only, as | |
6 | * 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 with | |
14 | * this program; if not, write to the Free Software Foundation, Inc., 51 | |
15 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
16 | */ | |
17 | ||
18 | #ifndef ROTATION_THREAD_H | |
19 | #define ROTATION_THREAD_H | |
20 | ||
21 | #include <urcu/list.h> | |
22 | #include <urcu.h> | |
23 | #include <urcu/rculfhash.h> | |
24 | #include <lttng/domain.h> | |
25 | #include <common/pipe.h> | |
26 | #include <common/compat/poll.h> | |
27 | #include <common/hashtable/hashtable.h> | |
28 | #include <pthread.h> | |
29 | #include "session.h" | |
30 | ||
d086f507 JD |
31 | /* |
32 | * The timer thread enqueues struct sessiond_rotation_timer objects in the list | |
33 | * and wake up the rotation thread. When the rotation thread wakes up, it | |
34 | * empties the queue. | |
35 | */ | |
36 | struct rotation_thread_timer_queue { | |
37 | struct lttng_pipe *event_pipe; | |
38 | struct cds_list_head list; | |
39 | pthread_mutex_t lock; | |
40 | }; | |
41 | ||
db66e574 JD |
42 | struct rotation_thread_handle { |
43 | /* | |
44 | * Read side of pipes used to communicate with the rotation thread. | |
45 | */ | |
46 | /* Notification from the consumers */ | |
47 | int ust32_consumer; | |
48 | int ust64_consumer; | |
49 | int kernel_consumer; | |
50 | /* quit pipe */ | |
51 | int thread_quit_pipe; | |
d086f507 | 52 | struct rotation_thread_timer_queue *rotation_timer_queue; |
db66e574 JD |
53 | }; |
54 | ||
55 | struct rotation_thread_handle *rotation_thread_handle_create( | |
56 | struct lttng_pipe *ust32_channel_rotate_pipe, | |
57 | struct lttng_pipe *ust64_channel_rotate_pipe, | |
58 | struct lttng_pipe *kernel_channel_rotate_pipe, | |
d086f507 JD |
59 | int thread_quit_pipe, |
60 | struct rotation_thread_timer_queue *rotation_timer_queue); | |
db66e574 JD |
61 | |
62 | void rotation_thread_handle_destroy( | |
63 | struct rotation_thread_handle *handle); | |
64 | ||
65 | void *thread_rotation(void *data); | |
66 | ||
67 | #endif /* ROTATION_THREAD_H */ |