X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Frotation-thread.h;h=27ef3954e5051520fdba794f900217626effab48;hp=41da6e0444e209855fe14d7986834e9dd1979c99;hb=a2814ea7573bf5edd5323d6f89c48ff14105db69;hpb=90936dcf0968343f20b2f6fd365b9c015cdb9717 diff --git a/src/bin/lttng-sessiond/rotation-thread.h b/src/bin/lttng-sessiond/rotation-thread.h index 41da6e044..27ef3954e 100644 --- a/src/bin/lttng-sessiond/rotation-thread.h +++ b/src/bin/lttng-sessiond/rotation-thread.h @@ -1,18 +1,9 @@ /* - * Copyright (C) 2017 - Julien Desfossez + * Copyright (C) 2017 Julien Desfossez + * Copyright (C) 2018 Jérémie Galarneau * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License, version 2 only, as - * published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef ROTATION_THREAD_H @@ -28,49 +19,33 @@ #include #include #include "session.h" +#include "notification-thread.h" -/* - * The timer thread enqueues struct sessiond_rotation_timer objects in the list - * and wake up the rotation thread. When the rotation thread wakes up, it - * empties the queue. - */ -struct rotation_thread_timer_queue { - struct lttng_pipe *event_pipe; - struct cds_list_head list; - pthread_mutex_t lock; -}; - -struct rotation_thread_handle { - /* - * Read side of pipes used to communicate with the rotation thread. - */ - /* Notification from the consumers */ - int ust32_consumer; - int ust64_consumer; - int kernel_consumer; - /* quit pipe */ - int thread_quit_pipe; +extern struct lttng_notification_channel *rotate_notification_channel; - struct rotation_thread_timer_queue *rotation_timer_queue; +enum rotation_thread_job_type { + ROTATION_THREAD_JOB_TYPE_SCHEDULED_ROTATION, + ROTATION_THREAD_JOB_TYPE_CHECK_PENDING_ROTATION +}; - /* Access to the notification thread cmd_queue */ - struct notification_thread_handle *notification_thread_handle; +struct rotation_thread_timer_queue; +struct rotation_thread_handle; - sem_t *notification_thread_ready; -}; +struct rotation_thread_timer_queue *rotation_thread_timer_queue_create(void); +void rotation_thread_timer_queue_destroy( + struct rotation_thread_timer_queue *queue); struct rotation_thread_handle *rotation_thread_handle_create( - struct lttng_pipe *ust32_channel_rotate_pipe, - struct lttng_pipe *ust64_channel_rotate_pipe, - struct lttng_pipe *kernel_channel_rotate_pipe, - int thread_quit_pipe, struct rotation_thread_timer_queue *rotation_timer_queue, - struct notification_thread_handle *notification_thread_handle, - sem_t *notification_thread_ready); + struct notification_thread_handle *notification_thread_handle); void rotation_thread_handle_destroy( struct rotation_thread_handle *handle); -void *thread_rotation(void *data); +void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue, + enum rotation_thread_job_type job_type, + struct ltt_session *session); + +bool launch_rotation_thread(struct rotation_thread_handle *handle); #endif /* ROTATION_THREAD_H */