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