]> git.ipfire.org Git - thirdparty/suricata.git/commit
threads: optimize start up check
authorVictor Julien <vjulien@oisf.net>
Mon, 27 May 2024 15:12:09 +0000 (17:12 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 29 May 2024 18:45:05 +0000 (20:45 +0200)
commit85fd4b2ec7d1812a3833ca715b39f18be448e64c
treec46cfffe5e19226137cf6530120634b4d45db39b
parent121955d5c173cd96b4e5e45cad8d6447854d6d74
threads: optimize start up check

When starting a large amount of threads, the loop was inefficient. It
would loop over the threads and if one wasn't yet ready it would sleep a
bit and then reevaluate all the threads. This reevaluation of threads
already checked was inefficient, and could lead to the time budget
running out.

This patch splits the check, and keeps track of the threads that have
already passed. This avoids the rescanning of already checked threads.
src/tm-threads.c