Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLAScommon
Commits
ec384970
Commit
ec384970
authored
Oct 21, 2020
by
Manuel Pitz
Browse files
list: add vlist_clear()
parent
5e7df923
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/villas/list.h
View file @
ec384970
...
...
@@ -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
);
...
...
lib/list.cpp
View file @
ec384970
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment