+/*
+ * RCU safe free context structure.
+ */
+static void destroy_context_rcu(struct rcu_head *head)
+{
+ struct cds_lfht_node *node =
+ caa_container_of(head, struct cds_lfht_node, head);
+ struct ltt_ust_context *ctx =
+ caa_container_of(node, struct ltt_ust_context, node);
+
+ free(ctx);
+}
+
+/*
+ * Cleanup UST context hash table.
+ */
+static void destroy_context(struct cds_lfht *ht)
+{
+ int ret;
+ struct cds_lfht_node *node;
+ struct cds_lfht_iter iter;
+
+ hashtable_get_first(ht, &iter);
+ while ((node = hashtable_iter_get_node(&iter)) != NULL) {
+ ret = hashtable_del(ht, &iter);
+ if (!ret) {
+ call_rcu(&node->head, destroy_context_rcu);
+ }
+ hashtable_get_next(ht, &iter);
+ }
+}
+