111 void *
Hash_Table_get(
struct Hash_Table *ht, uint64_t key ,
void *extra_arg,
int (*test_func)(
void *, uint64_t ,
void *));
int count
the number of elements
static void Hash_Table_use_lock(struct Hash_Table *ht)
Indicates that the hashtable must use a lock for operations (get/push)
This is the structure used to store the clusters (items that have the same hash)
void Hash_Table_walkthrought_cond(struct Hash_Table *ht, void(*action)(void *), int(*test_func)(void *, void *), void *test_value)
Executes a function on every stored elements that satisfy a condition.
uint8_t coll_avoid
maximum number of elements stored in the cluster static array
void Hash_Table_release_Internal(void *phi)
Releases internal hashtable data.
size_t intern_payload_size
the size of the internal static array (coll_avoid * sizeof_payload)
void Hash_Table_lock_cell(struct Hash_Table *ht, uint64_t key)
Locks a cell at given key.
void * Hash_Table_push(struct Hash_Table *ht, void *payload, uint64_t key)
adds an element to a hashtable
void * Hash_Table_push_unique(struct Hash_Table *ht, void *payload, uint64_t key, void *extra_arg, int(*test_func)(void *, uint64_t, void *))
Adds an element into the hashtable. Replaces already existing element at key.
void Hash_Table_walkthrought_cond_2p(struct Hash_Table *ht, void *second_arg, void(*action)(void *, void *), int(*test_func)(void *, void *), void *test_value)
Executes a function on every stored elements that satisfy a condition.
This a structure wrapps the use of chained_list This is the main chain list structure to use...
size_t sizeof_payload
the size of stored elements
void Hash_Table_unlock_cell(struct Hash_Table *ht, uint64_t key)
Unlocks a cell at given key.
This is the main hask table structure.
void Hash_Table_init(struct Hash_Table *ht, size_t sizeof_payload, uint64_t table_size, uint8_t coll_avoid)
Hash_Table initialization.
void Hash_Table_walkthrought_2p(struct Hash_Table *ht, void *second_arg, void(*action)(void *, void *))
Executes a function on every stored elements.
void * Hash_Table_get(struct Hash_Table *ht, uint64_t key, void *extra_arg, int(*test_func)(void *, uint64_t, void *))
retrieves an element from the hashtable
uint64_t Hash_Table_count_by_walk(struct Hash_Table *ht)
counts the elements in the hashtable by walking through all the elements
void Hash_Table_release(struct Hash_Table *ht, void(*free_f)(void *))
Hash_Table release.
void * payload
where data is stored (Hash_Table_Internal + cluster static array)
volatile unsigned int MALP_Spinlock
The type of spinlocks in MALP.
uint64_t table_size
the size of the table
void * Hash_Table_get_an_entry(struct Hash_Table *ht)
Retrieves the first found element of the hash table.
uint8_t need_lock
set to 1 if internals need to use a lock before access
MALP_Spinlock lock
a lock for concurrent access
struct Chained_List next_pl
the actual chained list (containing elements)
void Hash_Table_walkthrought(struct Hash_Table *ht, void(*action)(void *))
Executes a function on every stored elements.
void Hash_Table_init_Internal(void *phi, uint64_t coll_avoid, uint64_t intern_payload_size)
Initializes internal hashtable data.
void Hash_Table_walkthrought_3p(struct Hash_Table *ht, void *second_arg, void *third_arg, void(*action)(void *, void *, void *))
Executes a function on every stored elements.