Commit | Line | Data |
---|---|---|
de27ada2 JG |
1 | /* |
2 | * Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@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 NOTIFICATION_THREAD_H | |
19 | #define NOTIFICATION_THREAD_H | |
20 | ||
21 | #include <urcu/wfcqueue.h> | |
22 | #include <lttng/trigger/trigger.h> | |
c254fb11 | 23 | #include <pthread.h> |
de27ada2 JG |
24 | |
25 | enum notification_command_type { | |
26 | NOTIFICATION_COMMAND_TYPE_NEW_TRIGGER, | |
27 | }; | |
28 | ||
29 | struct notification_command { | |
30 | /* Futex on which to wait for command reply. */ | |
31 | int32_t futex; | |
32 | enum lttng_error_code result; | |
33 | enum notification_command_type type; | |
34 | }; | |
35 | ||
36 | struct notification_new_trigger_command { | |
37 | struct notification_command parent; | |
38 | /* Set to NULL if ownership was transfered. */ | |
39 | struct lttng_trigger *trigger; | |
40 | }; | |
41 | ||
42 | /* Data passed to the thread on initialization. */ | |
43 | struct notification_thread_data { | |
44 | /* | |
45 | * Queue of struct notification command. | |
46 | * event_fd must be WRITE(2) to signal that a new command | |
47 | * has been enqueued. | |
48 | */ | |
49 | struct notification_cmd_queue { | |
50 | int event_fd; | |
c254fb11 JG |
51 | struct cds_list_head list; |
52 | pthread_mutex_t lock; | |
de27ada2 JG |
53 | } cmd_queue; |
54 | }; | |
55 | ||
56 | struct notification_command *notification_new_trigger_command_create( | |
57 | struct lttng_trigger *trigger); | |
58 | struct notification_command *notification_new_trigger_command_destroy( | |
59 | struct lttng_trigger *trigger); | |
60 | ||
61 | void *thread_notification(void *data); | |
62 | ||
c254fb11 JG |
63 | struct notification_thread_data *notification_init_data(void); |
64 | void notification_destroy_data(struct notification_thread_data *data); | |
de27ada2 JG |
65 | |
66 | #endif /* NOTIFICATION_THREAD_H */ |