refactor: move locking responsibility to user
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
2a373f3841
commit
088322c18f
6 changed files with 100 additions and 88 deletions
|
|
@ -94,7 +94,8 @@ bool trie_add_no_lock(Trie *trie, const char *key, Entry *entry);
|
|||
* @param trie
|
||||
* @param entry entry to add
|
||||
* @param secure whether to generate a longer, more secure random key
|
||||
* @return the generated key
|
||||
* @return pointer to the generated key. This pointer is safe to use after
|
||||
* unlocking the trie, and should be freed manually.
|
||||
*/
|
||||
char *trie_add_random(Trie *trie, Entry *entry, bool secure);
|
||||
|
||||
|
|
@ -116,4 +117,28 @@ bool trie_remove(Trie *trie, const char *key);
|
|||
*/
|
||||
size_t trie_size(Trie *trie);
|
||||
|
||||
/*
|
||||
* Acquire a read lock on the trie.
|
||||
*
|
||||
* @return 0 if successful, non-zero otherwise (return value of
|
||||
* pthread_rwlock_rdlock)
|
||||
*/
|
||||
int trie_rlock(Trie *trie);
|
||||
|
||||
/*
|
||||
* Acquire a write lock on the trie.
|
||||
*
|
||||
* @return 0 if successful, non-zero otherwise (return value of
|
||||
* pthread_rwlock_wrlock)
|
||||
*/
|
||||
int trie_wlock(Trie *trie);
|
||||
|
||||
/*
|
||||
* Release the lock on a trie after having acquired it beforehand.
|
||||
*
|
||||
* @return 0 if successful, non-zero otherwise (return value of
|
||||
* pthread_rwlock_unlock)
|
||||
*/
|
||||
int trie_unlock(Trie *trie);
|
||||
|
||||
#endif // AD3_TERNARYTRIE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue