Commit | Line | Data |
---|---|---|
ab7d5fc6 MD |
1 | #ifndef _URCU_HT_H |
2 | #define _URCU_HT_H | |
3 | ||
674f7a69 | 4 | #include <stdint.h> |
ab7d5fc6 | 5 | |
5e28c532 MD |
6 | /* |
7 | * Caution ! | |
c4aed19a | 8 | * Ensure writer threads are registered as urcu readers and with urcu-defer. |
5e28c532 MD |
9 | * Ensure reader threads are registered as urcu readers. |
10 | */ | |
11 | ||
12 | typedef uint32_t (*ht_hash_fct)(void *key, uint32_t length, uint32_t initval); | |
674f7a69 MD |
13 | |
14 | /* | |
15 | * init_size must be power of two. | |
16 | */ | |
17 | struct rcu_ht *ht_new(ht_hash_fct hash_fct, void (*free_fct)(void *data), | |
5e28c532 MD |
18 | unsigned long init_size, uint32_t keylen, |
19 | uint32_t hashseed); | |
ab7d5fc6 | 20 | |
5e28c532 | 21 | int ht_delete_all(struct rcu_ht *ht); |
ab7d5fc6 | 22 | |
5e28c532 | 23 | int ht_destroy(struct rcu_ht *ht); |
ab7d5fc6 MD |
24 | |
25 | void *ht_lookup(struct rcu_ht *ht, void *key); | |
26 | ||
27 | int ht_add(struct rcu_ht *ht, void *key, void *data); | |
28 | ||
29 | int ht_delete(struct rcu_ht *ht, void *key); | |
30 | ||
31 | void *ht_steal(struct rcu_ht *ht, void *key); | |
32 | ||
464a1ec9 MD |
33 | void ht_resize(struct rcu_ht *ht, int growth); |
34 | ||
5e28c532 | 35 | uint32_t ht_jhash(void *key, uint32_t length, uint32_t initval); |
ab7d5fc6 MD |
36 | |
37 | #endif /* _URCU_HT_H */ |