]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/loader: set proper thread flags
authorVictor Julien <vjulien@oisf.net>
Fri, 5 May 2023 12:54:09 +0000 (14:54 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 5 May 2023 15:12:48 +0000 (17:12 +0200)
Fixes: 13beba141c98 ("source: add THV_RUNNING flag to notify of running state")
Bug: #6043.

src/detect-engine-loader.c

index 1ec6944f4ac5a7409f635da1ecfc8967ddd8306a..45ea349abdcb3c14a4c74c160ff43bec5831bf12 100644 (file)
@@ -582,6 +582,7 @@ static TmEcode DetectLoader(ThreadVars *th_v, void *thread_data)
     DetectLoaderThreadData *ftd = (DetectLoaderThreadData *)thread_data;
     BUG_ON(ftd == NULL);
 
+    TmThreadsSetFlag(th_v, THV_INIT_DONE | THV_RUNNING);
     SCLogDebug("loader thread started");
     while (1)
     {
@@ -619,6 +620,10 @@ static TmEcode DetectLoader(ThreadVars *th_v, void *thread_data)
         SCLogDebug("woke up...");
     }
 
+    TmThreadsSetFlag(th_v, THV_RUNNING_DONE);
+    TmThreadWaitForFlag(th_v, THV_DEINIT);
+    TmThreadsSetFlag(th_v, THV_CLOSED);
+
     return TM_ECODE_OK;
 }