MEDIUM: threads/server: Add a lock per server and atomically update server vars
The server's lock is use, among other things, to lock acces to the active
connection list of a server.
diff --git a/src/checks.c b/src/checks.c
index 3d60237..ed99bb5 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -242,7 +242,7 @@
if ((!(check->state & CHK_ST_AGENT) ||
(check->status >= HCHK_STATUS_L57DATA)) &&
(check->health >= check->rise)) {
- s->counters.failed_checks++;
+ HA_ATOMIC_ADD(&s->counters.failed_checks, 1);
report = 1;
check->health--;
if (check->health < check->rise)
@@ -410,7 +410,7 @@
return;
}
- s->consecutive_errors++;
+ HA_ATOMIC_ADD(&s->consecutive_errors, 1);
if (s->consecutive_errors < s->consecutive_errors_limit)
return;
@@ -449,7 +449,7 @@
}
s->consecutive_errors = 0;
- s->counters.failed_hana++;
+ HA_ATOMIC_ADD(&s->counters.failed_hana, 1);
if (s->check.fastinter) {
expire = tick_add(now_ms, MS_TO_TICKS(s->check.fastinter));