Made Util::streamName and exitReason thread-local

This commit is contained in:
Thulinma 2020-08-28 19:23:48 +02:00
parent 7c6da9d455
commit 7423868de4
11 changed files with 40 additions and 32 deletions

View file

@ -30,6 +30,7 @@
#include <iostream>
#include <pwd.h>
#include <signal.h>
#include <string.h>
#include <stdarg.h> // for va_list
#include <stdlib.h>
#include <sys/types.h>
@ -39,8 +40,13 @@ bool Util::Config::is_active = false;
bool Util::Config::is_restarting = false;
static Socket::Server *serv_sock_pointer = 0;
uint32_t Util::printDebugLevel = DEBUG;
std::string Util::streamName;
char Util::exitReason[256] ={0};
__thread char Util::streamName[256] = {0};
__thread char Util::exitReason[256] ={0};
void Util::setStreamName(const std::string & sn){
strncpy(Util::streamName, sn.c_str(), 256);
}
void Util::logExitReason(const char *format, ...){
if (exitReason[0]){return;}