feat(tree): add rwlock

This commit is contained in:
Jef Roosens 2023-03-07 12:12:46 +01:00
parent 83b3198a49
commit 1c563d8421
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
3 changed files with 32 additions and 0 deletions

View file

@ -67,4 +67,22 @@ void vieter_tree_iterator_free(vieter_tree_iterator **ptp);
vieter_tree_error vieter_tree_iterator_next(void **out,
vieter_tree_iterator *iter);
/*
* Acquire a read lock on the tree. Return value is the result of
* pthread_rwlock_rdlock.
*/
int vieter_tree_rlock(vieter_tree *tree);
/*
* Acquire a write lock on the tree. Return value is the result of
* pthread_rwlock_wrlock.
*/
int vieter_tree_wlock(vieter_tree *tree);
/*
* Unlock the lock after having acquired it. Return value is the result of
* pthread_rwlock_unlock.
*/
int vieter_tree_unlock(vieter_tree *tree);
#endif