summaryrefslogtreecommitdiffstats
path: root/src/libnetdata/avl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/libnetdata/avl/README.md21
-rw-r--r--src/libnetdata/avl/avl.c (renamed from libnetdata/avl/avl.c)4
-rw-r--r--src/libnetdata/avl/avl.h (renamed from libnetdata/avl/avl.h)0
3 files changed, 23 insertions, 2 deletions
diff --git a/src/libnetdata/avl/README.md b/src/libnetdata/avl/README.md
new file mode 100644
index 000000000..eb85f884e
--- /dev/null
+++ b/src/libnetdata/avl/README.md
@@ -0,0 +1,21 @@
+<!--
+title: "AVL"
+custom_edit_url: https://github.com/netdata/netdata/edit/master/src/libnetdata/avl/README.md
+sidebar_label: "AVL"
+learn_status: "Published"
+learn_topic_type: "Tasks"
+learn_rel_path: "Developers/libnetdata"
+-->
+
+# AVL
+
+AVL is a library indexing objects in B-Trees.
+
+`avl_insert()`, `avl_remove()` and `avl_search()` are adaptations
+of the AVL algorithm found in `libavl` v2.0.3, so that they do not
+use any memory allocations and their memory footprint is optimized
+(by eliminating non-necessary data members).
+
+In addition to the above, this version of AVL, provides versions using locks
+and traversal functions.
+
diff --git a/libnetdata/avl/avl.c b/src/libnetdata/avl/avl.c
index eef4c3116..e1d4064dc 100644
--- a/libnetdata/avl/avl.c
+++ b/src/libnetdata/avl/avl.c
@@ -334,7 +334,7 @@ static inline void avl_write_lock(avl_tree_lock *t) {
static inline void avl_read_unlock(avl_tree_lock *t) {
#if defined(AVL_LOCK_WITH_RWLOCK)
- netdata_rwlock_unlock(&t->rwlock);
+ netdata_rwlock_rdunlock(&t->rwlock);
#else
rw_spinlock_read_unlock(&t->rwlock);
#endif
@@ -342,7 +342,7 @@ static inline void avl_read_unlock(avl_tree_lock *t) {
static inline void avl_write_unlock(avl_tree_lock *t) {
#if defined(AVL_LOCK_WITH_RWLOCK)
- netdata_rwlock_unlock(&t->rwlock);
+ netdata_rwlock_wrunlock(&t->rwlock);
#else
rw_spinlock_write_unlock(&t->rwlock);
#endif
diff --git a/libnetdata/avl/avl.h b/src/libnetdata/avl/avl.h
index 595d6ec6c..595d6ec6c 100644
--- a/libnetdata/avl/avl.h
+++ b/src/libnetdata/avl/avl.h