+/*
+ * Create a poll set with O_CLOEXEC and add the thread quit pipe to the set.
+ */
+static int set_pollset(struct lttng_poll_event *events, size_t size)
+{
+ int ret;
+
+ ret = lttng_poll_create(events, size, LTTNG_CLOEXEC);
+ if (ret < 0) {
+ goto error;
+ }
+
+ ret = lttng_poll_add(events, ht_cleanup_quit_pipe[0],
+ LPOLLIN | LPOLLERR);
+ if (ret < 0) {
+ goto error;
+ }
+
+ ret = lttng_poll_add(events, the_ht_cleanup_pipe[0], LPOLLIN | LPOLLERR);
+ if (ret < 0) {
+ DBG("[ht-thread] lttng_poll_add error %d.", ret);
+ goto error;
+ }
+
+ return 0;
+
+error:
+ return ret;
+}
+
+static void cleanup_ht_cleanup_thread(void *data)
+{
+ utils_close_pipe(ht_cleanup_quit_pipe);
+ utils_close_pipe(the_ht_cleanup_pipe);
+}
+
+static void *thread_ht_cleanup(void *data)