Now that thanks to commit
c880c32b16 ("MINOR: stream: decrement
srv->served after detaching from the list") we can trust srv->served,
let's use it and no longer loop on threads when checking if a server
still has streams attached to it. This will be much cheaper and will
result in keeping isolation for a shorter time in the "wait" command.
return 0;
}
-/* Returns 1 if the server has streams pointing to it, and 0 otherwise.
- *
- * Must be called with the server lock held.
- */
+/* Returns 1 if the server has streams pointing to it, and 0 otherwise. */
static int srv_has_streams(struct server *srv)
{
- int thr;
-
- for (thr = 0; thr < global.nbthread; thr++)
- if (!MT_LIST_ISEMPTY(&srv->per_thr[thr].streams))
- return 1;
- return 0;
+ return !!_HA_ATOMIC_LOAD(&srv->served);
}
/* Shutdown all connections of a server. The caller must pass a termination