@cryptotaxi247 / netdata-1 / commits / 58ad5b6df

narrow the scope of the mutex

Costa Tsaousis (ktsaou) committed Mar 12, 2018 at 11:55 UTC 58ad5b6df35fcfb92826962df04b5db406e3fb5a
1 file changed +3 -3
src/backend_prometheus.c
+3 -3
@@ -12,13 +12,13 @@ static struct prometheus_server {
12 struct prometheus_server *next;
13 } *prometheus_server_root = NULL;
14
15 -static netdata_mutex_t prometheus_server_root_mutex = NETDATA_MUTEX_INITIALIZER;
16 -
15 static inline time_t prometheus_server_last_access(const char *server, RRDHOST *host, time_t now) {
16 + static netdata_mutex_t prometheus_server_root_mutex = NETDATA_MUTEX_INITIALIZER;
17 +
18 uint32_t hash = simple_hash(server);
19
20 netdata_mutex_lock(&prometheus_server_root_mutex);
21 -
21 +
22 struct prometheus_server *ps;
23 for(ps = prometheus_server_root; ps ;ps = ps->next) {
24 if (host == ps->host && hash == ps->hash && !strcmp(server, ps->server)) {