summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8501854)
raw | patch | inline | side by side (parent: 8501854)
author | Florian Forster <octo@collectd.org> | |
Fri, 17 Nov 2017 14:29:07 +0000 (15:29 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 17 Nov 2017 14:29:07 +0000 (15:29 +0100) |
src/utils_ovs.c | patch | blob | history |
diff --git a/src/utils_ovs.c b/src/utils_ovs.c
index e9e841e8d69d6386aa6547dc55ebff7136172eb3..ae82253bff2941a03dba07c108e3196d75ebd058 100644 (file)
--- a/src/utils_ovs.c
+++ b/src/utils_ovs.c
/* Remove all callbacks form OVS DB object */
static void ovs_db_callback_remove_all(ovs_db_t *pdb) {
pthread_mutex_lock(&pdb->mutex);
- for (ovs_callback_t *del_cb = pdb->remote_cb; pdb->remote_cb;
- del_cb = pdb->remote_cb) {
+ while (pdb->remote_cb != NULL) {
+ ovs_callback_t *del_cb = pdb->remote_cb;
pdb->remote_cb = del_cb->next;
- free(del_cb);
+ sfree(del_cb);
}
- pdb->remote_cb = NULL;
pthread_mutex_unlock(&pdb->mutex);
}
}
/* Destroy EVENT thread */
+/* XXX: Must hold pdb->mutex when calling! */
static int ovs_db_event_thread_destroy(ovs_db_t *pdb) {
if (pthread_equal(pdb->event_thread.tid, (pthread_t){0})) {
/* already destroyed */
}
/* Destroy POLL thread */
+/* XXX: Must hold pdb->mutex when calling! */
static int ovs_db_poll_thread_destroy(ovs_db_t *pdb) {
if (pthread_equal(pdb->poll_thread.tid, (pthread_t){0})) {
/* already destroyed */
/* stop poll thread */
if (ovs_db_event_thread_destroy(pdb) < 0) {
OVS_ERROR("destroy poll thread failed");
- ovs_db_ret = (-1);
+ ovs_db_ret = -1;
}
/* stop event thread */
if (ovs_db_poll_thread_destroy(pdb) < 0) {
OVS_ERROR("stop event thread failed");
- ovs_db_ret = (-1);
+ ovs_db_ret = -1;
}
pthread_mutex_unlock(&pdb->mutex);