{
DBG("Cleaning up");
- /* Close thread quit pipes */
- utils_close_pipe(live_thread_quit_pipe);
free(live_uri);
}
futex_nto1_wake(&viewer_cmd_queue.futex);
}
-/*
- * Init thread quit pipe.
- *
- * Return -1 on error or 0 if all pipes are created.
- */
-static
-int init_thread_quit_pipe(void)
-{
- int ret;
-
- ret = utils_create_pipe_cloexec(live_thread_quit_pipe);
-
- return ret;
-}
-
/*
* Create a poll set with O_CLOEXEC and add the thread quit pipe to the set.
*/
* main
*/
int live_start_threads(struct lttng_uri *uri,
- struct relay_local_data *relay_ctx)
+ struct relay_local_data *relay_ctx, int quit_pipe[2])
{
int ret = 0;
void *status;
assert(uri);
live_uri = uri;
- /* Create thread quit pipe */
- if ((ret = init_thread_quit_pipe()) < 0) {
- goto error;
- }
+ live_thread_quit_pipe[0] = quit_pipe[0];
+ live_thread_quit_pipe[1] = quit_pipe[1];
/* Check if daemon is UID = 0 */
is_root = !getuid();
#include "lttng-relayd.h"
int live_start_threads(struct lttng_uri *live_uri,
- struct relay_local_data *relay_ctx);
+ struct relay_local_data *relay_ctx, int quit_pipe[2]);
void live_stop_threads(void);
struct relay_viewer_stream *live_find_viewer_stream_by_id(uint64_t stream_id);
goto exit_listener;
}
- ret = live_start_threads(live_uri, relay_ctx);
+ ret = live_start_threads(live_uri, relay_ctx, thread_quit_pipe);
if (ret != 0) {
ERR("Starting live viewer threads");
}
PERROR("pthread_join");
goto error; /* join error, exit without cleanup */
}
+
+ live_stop_threads();
lttng_ht_destroy(viewer_streams_ht);
exit_relay_ctx_viewer_streams:
free(relay_ctx);
exit:
- live_stop_threads();
cleanup();
if (!ret) {
exit(EXIT_SUCCESS);