lib: rename threadvars creation function

Also use a proper return type (ThreadVars *).

Ticket: #7240
pull/12891/head
Jason Ish 1 year ago committed by Victor Julien
parent 5e94be63ce
commit 201b3a6001

@ -31,7 +31,7 @@ static void *SimpleWorker(void *arg)
char *pcap_file = (char *)arg;
/* Create worker. */
ThreadVars *tv = RunModeCreateWorker();
ThreadVars *tv = SCRunModeLibCreateThreadVars();
if (!tv) {
pthread_exit(NULL);
}

@ -59,13 +59,7 @@ const char *RunModeLibGetDefaultMode(void)
return "live";
}
/** \brief create a "fake" worker thread in charge of processing the packets.
*
* This method just creates a context representing the worker, which is handled from the library
* client. No actual thread (pthread_t) is created.
*
* \return Pointer to ThreadVars structure representing the worker thread */
void *RunModeCreateWorker(void)
ThreadVars *SCRunModeLibCreateThreadVars(void)
{
char tname[TM_THREAD_NAME_MAX];
TmModule *tm_module = NULL;

@ -25,6 +25,8 @@
#ifndef SURICATA_RUNMODE_LIB_H
#define SURICATA_RUNMODE_LIB_H
#include "threadvars.h"
/** \brief register runmodes for suricata as a library */
void RunModeIdsLibRegister(void);
@ -37,13 +39,15 @@ int RunModeIdsLibOffline(void);
/** \brief runmode default mode (live) */
const char *RunModeLibGetDefaultMode(void);
/** \brief create a "fake" worker thread in charge of processing the packets.
/**
* \brief Create ThreadVars for use by a user provided thread.
*
* This method just creates a context representing the worker, which is handled from the library
* client. No actual thread (pthread_t) is created.
* Unlike other runmodes, this does not spawn a thread, as the threads
* are controlled by the application using Suricata as a library.
*
* \return Pointer to ThreadVars structure representing the worker thread */
void *RunModeCreateWorker(void);
* \return Pointer to allocated ThreadVars or NULL on failure
*/
ThreadVars *SCRunModeLibCreateThreadVars(void);
/** \brief start the "fake" worker.
*

Loading…
Cancel
Save