Make M_CheckParm thread-safe, it is called from different thread in http-mserv.c for example

This commit is contained in:
indev committed 2026-11-03 23:56:22 +03:00
1 parent 51adf8869c
commit 9682ab59c9
1 file changed
+12 -2
+12 -2
View File
@@ -13,6 +13,13 @@
#include <string.h>
#ifdef HAVE_THREADS
#include <threads.h>
#define local_for_thread thread_local
#else
#define local_for_thread
#endif
#include "doomdef.h"
#include "command.h"
#include "m_argv.h"
@@ -31,8 +38,11 @@ char **myargv = NULL;
boolean myargmalloc = false;
/** \brief founded the parm
*
* thread_local because it can potentially be used from multiple threads (global variables aaaaaa)
* (myargc and myargv don't have to be thread_local because they are never modified after being set up)
*/
static INT32 found;
static local_for_thread INT32 found;
/** \brief The M_CheckParm function
@@ -91,7 +101,7 @@ INT32 M_CheckProtoParam(const char *check)
const char *M_GetProtoParam(void)
{
INT32 i;
static char *string;
char *string;
for (i = 1; i < myargc; i++)
{