- ret = read(ht_cleanup_pipe[0], &ht, sizeof(ht));
- } while (ret < 0 && errno == EINTR);
- if (ret < 0 || ret < sizeof(ht)) {
- PERROR("ht cleanup notify pipe");
+ size_ret = lttng_read(ht_cleanup_pipe[0], &ht,
+ sizeof(ht));
+ if (size_ret < sizeof(ht)) {
+ PERROR("ht cleanup notify pipe");
+ goto error;
+ }
+ health_code_update();
+ /*
+ * The whole point of this thread is to call
+ * lttng_ht_destroy from a context that is NOT:
+ * 1) a read-side RCU lock,
+ * 2) a call_rcu thread.
+ */
+ lttng_ht_destroy(ht);
+
+ health_code_update();
+ } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {
+ ERR("ht cleanup pipe error");
+ goto error;
+ } else {
+ ERR("Unexpected poll events %u for sock %d", revents, pollfd);