feat(heap): thread-safety features
Some checks are pending
ci/woodpecker/pr/lint Pipeline is pending
ci/woodpecker/pr/test-mem Pipeline is pending
ci/woodpecker/pr/test Pipeline is pending

This commit is contained in:
Jef Roosens 2023-01-27 20:59:06 +01:00
parent d77b3e4fee
commit 5b2ce6acaa
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
4 changed files with 41 additions and 3 deletions

View file

@ -11,7 +11,7 @@ typedef enum vieter_heap_error {
} vieter_heap_error;
/*
* Allocate and initalize an empty heap.
* Allocate and initialize an empty heap.
*/
vieter_heap *vieter_heap_init();
@ -41,4 +41,22 @@ vieter_heap_error vieter_heap_pop(void **out, vieter_heap *heap);
*/
vieter_heap_error vieter_heap_peek(void **out, vieter_heap *heap);
/*
* Acquire a read lock on the heap. Return value is the result of
* pthread_rwlock_rdlock.
*/
int vieter_heap_rlock(vieter_heap *heap);
/*
* Acquire a write lock on the heap. Return value is the result of
* pthread_rwlock_wrlock.
*/
int vieter_heap_wlock(vieter_heap *heap);
/*
* Unlock the lock after having acquired it. Return value is the result of
* pthread_rwlock_unlock.
*/
int vieter_heap_unlock(vieter_heap *heap);
#endif