1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

add vlist_init_and_push()

This commit is contained in:
Steffen Vogel 2020-09-03 14:45:17 +02:00
parent db85cc6653
commit de94fb6abf
2 changed files with 18 additions and 1 deletions

View file

@ -153,4 +153,6 @@ ssize_t vlist_lookup_index(struct vlist *l, const std::string &name)
auto *f = vlist_lookup_name<T>(l, name);
return f ? vlist_index(l, f) : -1;
}
}
int vlist_init_and_push(struct vlist *l, void *p);

View file

@ -287,3 +287,18 @@ void vlist_filter(struct vlist *l, dtor_cb_t cb)
pthread_mutex_unlock(&l->lock);
}
int vlist_init_and_push(struct vlist *l, void *p)
{
int ret;
if (l->state == State::DESTROYED) {
ret = vlist_init(l);
if (ret)
return ret;
}
vlist_push(l, p);
return 0;
}