]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: thread: also remove a thread's bit from stopping_threads on stop
authorWilly Tarreau <w@1wt.eu>
Wed, 6 Jul 2022 08:17:21 +0000 (10:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Jul 2022 08:19:46 +0000 (10:19 +0200)
As much as possible we should take care of not leaving bits from stopped
threads in shared thread masks. It can avoid issues like the previous
fix and will also make debugging less confusing.

src/haproxy.c

index f86e3b5739a38a0b8fac81de2ebaf4c4a4455cee..85467a58fbe1d312d94f089a72933ec24ee57b39 100644 (file)
@@ -2988,6 +2988,8 @@ static void *run_thread_poll_loop(void *data)
 #ifdef USE_THREAD
        if (!_HA_ATOMIC_AND_FETCH(&ha_tgroup_info[ti->tgid-1].threads_enabled, ~ti->ltid_bit))
                _HA_ATOMIC_AND(&all_tgroups_mask, ~tg->tgid_bit);
+       if (!_HA_ATOMIC_AND_FETCH(&tg_ctx->stopping_threads, ~ti->ltid_bit))
+               _HA_ATOMIC_AND(&stopping_tgroup_mask, ~tg->tgid_bit);
        _HA_ATOMIC_AND(&all_threads_mask, ~tid_bit);
        if (tid > 0)
                pthread_exit(NULL);