summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 40cb189)
raw | patch | inline | side by side (parent: 40cb189)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 27 Jun 2014 17:40:37 +0000 (19:40 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 27 Jun 2014 17:40:37 +0000 (19:40 +0200) |
src/core/store.c | patch | blob | history |
diff --git a/src/core/store.c b/src/core/store.c
index 9fb05dfdf72c8ff20a8a783ad9069746b7651878..1b8243b091d4149a98dabea39927b5eb661b122c 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
*/
static sdb_llist_t *host_list = NULL;
-static pthread_rwlock_t obj_lock = PTHREAD_RWLOCK_INITIALIZER;
+static pthread_rwlock_t host_lock = PTHREAD_RWLOCK_INITIALIZER;
/*
* private types
return HOST(sdb_llist_search_by_name(host_list, name));
} /* lookup_host */
-/* The obj_lock has to be acquired before calling this function. */
+/* The host_lock has to be acquired before calling this function. */
static int
store_obj(const char *hostname, int type, const char *name,
sdb_time_t last_update, sdb_store_obj_t **updated_obj)
if (! name)
return -1;
- pthread_rwlock_wrlock(&obj_lock);
+ pthread_rwlock_wrlock(&host_lock);
status = store_obj(/* hostname = */ NULL,
/* stored object = */ SDB_HOST, name, last_update,
/* updated_obj = */ NULL);
- pthread_rwlock_unlock(&obj_lock);
+ pthread_rwlock_unlock(&host_lock);
return status;
} /* sdb_store_host */
if ((! hostname) || (! key))
return -1;
- pthread_rwlock_wrlock(&obj_lock);
+ pthread_rwlock_wrlock(&host_lock);
status = store_obj(hostname,
/* stored object = */ SDB_ATTRIBUTE, key, last_update,
&updated_attr);
}
}
- pthread_rwlock_unlock(&obj_lock);
+ pthread_rwlock_unlock(&host_lock);
return status;
} /* sdb_store_attribute */
if ((! hostname) || (! name))
return -1;
- pthread_rwlock_wrlock(&obj_lock);
+ pthread_rwlock_wrlock(&host_lock);
status = store_obj(hostname,
/* stored object = */ SDB_SERVICE, name, last_update,
/* updated obj = */ NULL);
- pthread_rwlock_unlock(&obj_lock);
+ pthread_rwlock_unlock(&host_lock);
return status;
} /* sdb_store_service */
if (! buf)
return -1;
- pthread_rwlock_rdlock(&obj_lock);
+ pthread_rwlock_rdlock(&host_lock);
host_iter = sdb_llist_get_iter(host_list);
if (! host_iter) {
- pthread_rwlock_unlock(&obj_lock);
+ pthread_rwlock_unlock(&host_lock);
return -1;
}
sdb_strbuf_append(buf, "]}");
sdb_llist_iter_destroy(host_iter);
- pthread_rwlock_unlock(&obj_lock);
+ pthread_rwlock_unlock(&host_lock);
return 0;
} /* sdb_store_tojson */
sdb_llist_iter_t *host_iter;
int status = 0;
- pthread_rwlock_rdlock(&obj_lock);
+ pthread_rwlock_rdlock(&host_lock);
host_iter = sdb_llist_get_iter(host_list);
if (! host_iter)
}
sdb_llist_iter_destroy(host_iter);
- pthread_rwlock_unlock(&obj_lock);
+ pthread_rwlock_unlock(&host_lock);
return status;
} /* sdb_store_iterate */