Commit ec384970 authored by Manuel Pitz's avatar Manuel Pitz
Browse files

list: add vlist_clear()

parent 5e7df923
......@@ -85,6 +85,9 @@ int vlist_destroy(struct vlist *l, dtor_cb_t dtor = nullptr, bool free = false)
/** Append an element to the end of the list */
void vlist_push(struct vlist *l, void *p);
/** Clear list */
void vlist_clear(struct vlist *l);
/** Remove all occurences of a list item */
void vlist_remove_all(struct vlist *l, void *p);
......
......@@ -96,6 +96,15 @@ void vlist_push(struct vlist *l, void *p)
pthread_mutex_unlock(&l->lock);
}
void vlist_clear(struct vlist *l)
{
pthread_mutex_lock(&l->lock);
l->length = 0;
pthread_mutex_unlock(&l->lock);
}
int vlist_remove(struct vlist *l, size_t idx)
{
pthread_mutex_lock(&l->lock);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment