Let's also check for other threads when the current one is queueing,
let's not wait for the load to be high. Now this totally eliminates
differences between threads.
* other thread.
*/
while (attempts-- > 0 &&
- my_load >= 3 && _HA_ATOMIC_LOAD(&th_ctx->active_checks) >= 3) {
+ (!LIST_ISEMPTY(&th_ctx->queued_checks) || my_load >= 3) &&
+ _HA_ATOMIC_LOAD(&th_ctx->active_checks) >= 3) {
uint new_tid = statistical_prng_range(global.nbthread);
if (new_tid == tid)