rcuja: shadow clear also frees the rcu ja node associated
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 12 Aug 2012 20:13:27 +0000 (16:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 14 May 2013 14:20:23 +0000 (16:20 +0200)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
rcuja/rcuja-internal.h
rcuja/rcuja-shadow-nodes.c

index a8402cc3faee8063e0271e45b063307788f229b0..b892a8747cf89b5250369b5558c6830c9647ff33 100644 (file)
@@ -49,4 +49,20 @@ struct rcu_ja {
        struct cds_lfht *ht;
 };
 
+__attribute__((visibility("protected")))
+struct rcu_ja_shadow_node *rcuja_shadow_lookup_lock(struct cds_lfht *ht,
+               struct rcu_ja_node *node);
+__attribute__((visibility("protected")))
+void rcuja_shadow_unlock(struct rcu_ja_shadow_node *shadow_node);
+__attribute__((visibility("protected")))
+int rcuja_shadow_set(struct cds_lfht *ht,
+               struct rcu_ja_node *node);
+__attribute__((visibility("protected")))
+int rcuja_shadow_clear_and_free_node(struct cds_lfht *ht,
+               struct rcu_ja_node *node);
+__attribute__((visibility("protected")))
+struct cds_lfht *rcuja_create_ht(void);
+__attribute__((visibility("protected")))
+void rcuja_delete_ht(struct cds_lfht *ht);
+
 #endif /* _URCU_RCUJA_INTERNAL_H */
index 6264a3aa54df2449b59dd1c72c940c94072f4fba..b737e26711504d9cba41cd8ef478574c491a5377 100644 (file)
@@ -215,6 +215,7 @@ rcu_unlock:
        return shadow_node;
 }
 
+__attribute__((visibility("protected")))
 void rcuja_shadow_unlock(struct rcu_ja_shadow_node *shadow_node)
 {
        int ret;
@@ -253,15 +254,16 @@ int rcuja_shadow_set(struct cds_lfht *ht,
 }
 
 static
-void free_shadow_node(struct rcu_head *head)
+void free_shadow_node_and_node(struct rcu_head *head)
 {
        struct rcu_ja_shadow_node *shadow_node =
                caa_container_of(head, struct rcu_ja_shadow_node, head);
+       free(shadow_node->node);
        free(shadow_node);
 }
 
 __attribute__((visibility("protected")))
-int rcuja_shadow_clear(struct cds_lfht *ht,
+int rcuja_shadow_clear_and_free_node(struct cds_lfht *ht,
                struct rcu_ja_node *node)
 {
        struct cds_lfht_iter iter;
@@ -289,7 +291,7 @@ int rcuja_shadow_clear(struct cds_lfht *ht,
         */
        ret = cds_lfht_del(ht, lookup_node);
        if (!ret) {
-               call_rcu(&shadow_node->head, free_shadow_node);
+               call_rcu(&shadow_node->head, free_shadow_node_and_node);
        }
        lockret = pthread_mutex_unlock(&shadow_node->lock);
        assert(!lockret);
This page took 0.025752 seconds and 4 git commands to generate.