mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-06-17 21:00:53 +00:00
Implement Assertion properly, TID printing in debug builds
This commit is contained in:
+19
-7
@@ -1,9 +1,19 @@
|
|||||||
// Author: lionkor
|
// Author: lionkor
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Asserts are to be used anywhere where assumptions about state are made
|
||||||
|
* implicitly. AssertNotReachable is used where code should never go, like in
|
||||||
|
* default switch cases which shouldn't trigger. They make it explicit
|
||||||
|
* that a place cannot normally be reached and make it an error if they do.
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <sstream>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
@@ -30,23 +40,25 @@ static const char* const ANSI_WHITE_BOLD = "\u001b[37;1m";
|
|||||||
static const char* const ANSI_BOLD = "\u001b[1m";
|
static const char* const ANSI_BOLD = "\u001b[1m";
|
||||||
static const char* const ANSI_UNDERLINE = "\u001b[4m";
|
static const char* const ANSI_UNDERLINE = "\u001b[4m";
|
||||||
|
|
||||||
inline void _assert(const char* file, const char* function, unsigned line,
|
inline void _assert([[maybe_unused]] const char* file, [[maybe_unused]] const char* function, [[maybe_unused]] unsigned line,
|
||||||
const char* condition_string, bool result) {
|
[[maybe_unused]] const char* condition_string, [[maybe_unused]] bool result) {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
fprintf(stderr,
|
std::stringstream ss;
|
||||||
"%sASSERTION FAILED%s at %s%s:%u%s \n\t-> in %s%s%s, Line %u: \n\t\t-> "
|
ss << std::this_thread::get_id();
|
||||||
|
fprintf(stdout,
|
||||||
|
"(debug build) TID %s: %sASSERTION FAILED%s at %s%s:%u%s in \n\t-> in %s%s%s, Line %u: \n\t\t-> "
|
||||||
"Failed Condition: %s%s%s\n",
|
"Failed Condition: %s%s%s\n",
|
||||||
ANSI_RED_BOLD, ANSI_RESET, ANSI_UNDERLINE, file, line, ANSI_RESET,
|
ss.str().c_str(), ANSI_RED_BOLD, ANSI_RESET, ANSI_UNDERLINE, file, line, ANSI_RESET,
|
||||||
ANSI_BOLD, function, ANSI_RESET, line, ANSI_RED, condition_string,
|
ANSI_BOLD, function, ANSI_RESET, line, ANSI_RED, condition_string,
|
||||||
ANSI_RESET);
|
ANSI_RESET);
|
||||||
fprintf(stderr, "%s... terminating with SIGABRT ...%s\n", ANSI_BOLD, ANSI_RESET);
|
fprintf(stdout, "%s... terminating with SIGABRT ...%s\n", ANSI_BOLD, ANSI_RESET);
|
||||||
abort();
|
abort();
|
||||||
#else
|
#else
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
sprintf(buf,
|
sprintf(buf,
|
||||||
"%s=> ASSERTION `%s` FAILED IN RELEASE BUILD%s%s -> IGNORING FAILED ASSERTION "
|
"%s=> ASSERTION `%s` FAILED IN RELEASE BUILD%s%s -> IGNORING FAILED ASSERTION "
|
||||||
"& HOPING IT WON'T CRASH%s\n",
|
"& HOPING IT WON'T CRASH%s",
|
||||||
ANSI_RED_BOLD, condition_string, ANSI_RESET, ANSI_RED, ANSI_RESET);
|
ANSI_RED_BOLD, condition_string, ANSI_RESET, ANSI_RED, ANSI_RESET);
|
||||||
error(buf);
|
error(buf);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#define SOCKET int
|
#define SOCKET int
|
||||||
#endif
|
#endif
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
|
#include "Assert.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -65,6 +66,7 @@ struct ClientInterface{
|
|||||||
c = nullptr;
|
c = nullptr;
|
||||||
}
|
}
|
||||||
void AddClient(Client *c){
|
void AddClient(Client *c){
|
||||||
|
Assert(c);
|
||||||
Clients.insert(c);
|
Clients.insert(c);
|
||||||
}
|
}
|
||||||
int Size(){
|
int Size(){
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ void InitLog();
|
|||||||
#define DebugPrintTID(what) DebugPrintTIDInternal(what, __func__)
|
#define DebugPrintTID(what) DebugPrintTIDInternal(what, __func__)
|
||||||
void DebugPrintTIDInternal(const std::string& what, const std::string& func); // prints the current thread id in debug mode, to make tracing of crashes and asserts easier
|
void DebugPrintTIDInternal(const std::string& what, const std::string& func); // prints the current thread id in debug mode, to make tracing of crashes and asserts easier
|
||||||
void ConsoleOut(const std::string& msg);
|
void ConsoleOut(const std::string& msg);
|
||||||
|
void QueueAbort();
|
||||||
void except(const std::string& toPrint);
|
void except(const std::string& toPrint);
|
||||||
void debug(const std::string& toPrint);
|
void debug(const std::string& toPrint);
|
||||||
void error(const std::string& toPrint);
|
void error(const std::string& toPrint);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
///
|
///
|
||||||
#include "Security/Enc.h"
|
#include "Security/Enc.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "Assert.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@@ -77,6 +78,7 @@ std::string RemoveComments(const std::string& Line){
|
|||||||
return Return;
|
return Return;
|
||||||
}
|
}
|
||||||
void LoadConfig(std::ifstream& IFS){
|
void LoadConfig(std::ifstream& IFS){
|
||||||
|
Assert(IFS.is_open());
|
||||||
std::string line;
|
std::string line;
|
||||||
int index = 1;
|
int index = 1;
|
||||||
while (getline(IFS, line)) {
|
while (getline(IFS, line)) {
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ std::string GenerateM(RSA*key){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Identification(SOCKET TCPSock,Hold*S,RSA*Skey){
|
void Identification(SOCKET TCPSock,Hold*S,RSA*Skey){
|
||||||
|
Assert(S);
|
||||||
|
Assert(Skey);
|
||||||
S->TCPSock = TCPSock;
|
S->TCPSock = TCPSock;
|
||||||
std::thread Timeout(Check,S);
|
std::thread Timeout(Check,S);
|
||||||
Timeout.detach();
|
Timeout.detach();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ int FC(const std::string& s,const std::string& p,int n) {
|
|||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
void Apply(Client*c,int VID,const std::string& pckt){
|
void Apply(Client*c,int VID,const std::string& pckt){
|
||||||
|
Assert(c);
|
||||||
std::string Packet = pckt;
|
std::string Packet = pckt;
|
||||||
std::string VD = c->GetCarData(VID);
|
std::string VD = c->GetCarData(VID);
|
||||||
Packet = Packet.substr(FC(Packet, ",", 2) + 1);
|
Packet = Packet.substr(FC(Packet, ",", 2) + 1);
|
||||||
@@ -31,6 +32,7 @@ void Apply(Client*c,int VID,const std::string& pckt){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VehicleParser(Client*c,const std::string& Pckt){
|
void VehicleParser(Client*c,const std::string& Pckt){
|
||||||
|
Assert(c);
|
||||||
if(c == nullptr || Pckt.length() < 4)return;
|
if(c == nullptr || Pckt.length() < 4)return;
|
||||||
std::string Packet = Pckt;
|
std::string Packet = Pckt;
|
||||||
char Code = Packet.at(1);
|
char Code = Packet.at(1);
|
||||||
@@ -94,10 +96,12 @@ void VehicleParser(Client*c,const std::string& Pckt){
|
|||||||
SendToAll(c,Packet,false,true);
|
SendToAll(c,Packet,false,true);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
AssertNotReachable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SyncClient(Client*c){
|
void SyncClient(Client*c){
|
||||||
|
Assert(c);
|
||||||
if(c->isSynced)return;
|
if(c->isSynced)return;
|
||||||
c->isSynced = true;
|
c->isSynced = true;
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
@@ -119,6 +123,7 @@ void SyncClient(Client*c){
|
|||||||
info(c->GetName() + Sec(" is now synced!"));
|
info(c->GetName() + Sec(" is now synced!"));
|
||||||
}
|
}
|
||||||
void ParseVeh(Client*c, const std::string& Packet){
|
void ParseVeh(Client*c, const std::string& Packet){
|
||||||
|
Assert(c);
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
__try{
|
__try{
|
||||||
VehicleParser(c,Packet);
|
VehicleParser(c,Packet);
|
||||||
@@ -129,6 +134,7 @@ void ParseVeh(Client*c, const std::string& Packet){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HandleEvent(Client*c ,const std::string&Data){
|
void HandleEvent(Client*c ,const std::string&Data){
|
||||||
|
Assert(c);
|
||||||
std::stringstream ss(Data);
|
std::stringstream ss(Data);
|
||||||
std::string t,Name;
|
std::string t,Name;
|
||||||
int a = 0;
|
int a = 0;
|
||||||
@@ -149,6 +155,7 @@ void HandleEvent(Client*c ,const std::string&Data){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GlobalParser(Client*c, const std::string& Pack){
|
void GlobalParser(Client*c, const std::string& Pack){
|
||||||
|
Assert(c);
|
||||||
[[maybe_unused]] static int lastRecv = 0;
|
[[maybe_unused]] static int lastRecv = 0;
|
||||||
if(Pack.empty() || c == nullptr)return;
|
if(Pack.empty() || c == nullptr)return;
|
||||||
std::string Packet = Pack.substr(0,Pack.find(char(0)));
|
std::string Packet = Pack.substr(0,Pack.find(char(0)));
|
||||||
@@ -196,6 +203,7 @@ void GlobalParser(Client*c, const std::string& Pack){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GParser(Client*c, const std::string& Packet){
|
void GParser(Client*c, const std::string& Packet){
|
||||||
|
Assert(c);
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
__try{
|
__try{
|
||||||
GlobalParser(c, Packet);
|
GlobalParser(c, Packet);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
///
|
///
|
||||||
#define CURL_STATICLIB
|
#define CURL_STATICLIB
|
||||||
#include "Curl/curl.h"
|
#include "Curl/curl.h"
|
||||||
|
#include "Assert.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp){
|
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp){
|
||||||
((std::string*)userp)->append((char*)contents, size * nmemb);
|
((std::string*)userp)->append((char*)contents, size * nmemb);
|
||||||
@@ -13,6 +14,7 @@ std::string HttpRequest(const std::string& IP,int port){
|
|||||||
CURLcode res;
|
CURLcode res;
|
||||||
std::string readBuffer;
|
std::string readBuffer;
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
|
Assert(curl);
|
||||||
if(curl) {
|
if(curl) {
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, IP.c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, IP.c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_PORT, port);
|
curl_easy_setopt(curl, CURLOPT_PORT, port);
|
||||||
@@ -30,6 +32,7 @@ std::string PostHTTP(const std::string& IP,const std::string& Fields){
|
|||||||
CURLcode res;
|
CURLcode res;
|
||||||
std::string readBuffer;
|
std::string readBuffer;
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
|
Assert(curl);
|
||||||
if(curl) {
|
if(curl) {
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, IP.c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, IP.c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, Fields.size());
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, Fields.size());
|
||||||
@@ -42,4 +45,4 @@ std::string PostHTTP(const std::string& IP,const std::string& Fields){
|
|||||||
if(res != CURLE_OK)return "-1";
|
if(res != CURLE_OK)return "-1";
|
||||||
}
|
}
|
||||||
return readBuffer;
|
return readBuffer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ int OpenID(){
|
|||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
void Respond(Client*c, const std::string& MSG, bool Rel){
|
void Respond(Client*c, const std::string& MSG, bool Rel){
|
||||||
|
Assert(c);
|
||||||
char C = MSG.at(0);
|
char C = MSG.at(0);
|
||||||
if(Rel || C == 'W' || C == 'Y' || C == 'V' || C == 'E'){
|
if(Rel || C == 'W' || C == 'Y' || C == 'V' || C == 'E'){
|
||||||
if(C == 'O' || C == 'T' || MSG.length() > 1000)SendLarge(c,MSG);
|
if(C == 'O' || C == 'T' || MSG.length() > 1000)SendLarge(c,MSG);
|
||||||
@@ -31,6 +32,7 @@ void Respond(Client*c, const std::string& MSG, bool Rel){
|
|||||||
}else UDPSend(c,MSG);
|
}else UDPSend(c,MSG);
|
||||||
}
|
}
|
||||||
void SendToAll(Client*c, const std::string& Data, bool Self, bool Rel){
|
void SendToAll(Client*c, const std::string& Data, bool Self, bool Rel){
|
||||||
|
Assert(c);
|
||||||
char C = Data.at(0);
|
char C = Data.at(0);
|
||||||
for(Client*client : CI->Clients){
|
for(Client*client : CI->Clients){
|
||||||
if(client != nullptr) {
|
if(client != nullptr) {
|
||||||
@@ -55,6 +57,7 @@ void UpdatePlayers(){
|
|||||||
SendToAll(nullptr, Packet,true,true);
|
SendToAll(nullptr, Packet,true,true);
|
||||||
}
|
}
|
||||||
void OnDisconnect(Client*c,bool kicked){
|
void OnDisconnect(Client*c,bool kicked){
|
||||||
|
Assert(c);
|
||||||
info(c->GetName() + Sec(" Connection Terminated"));
|
info(c->GetName() + Sec(" Connection Terminated"));
|
||||||
if(c == nullptr)return;
|
if(c == nullptr)return;
|
||||||
std::string Packet;
|
std::string Packet;
|
||||||
@@ -73,6 +76,7 @@ void OnDisconnect(Client*c,bool kicked){
|
|||||||
CI->RemoveClient(c); ///Removes the Client from existence
|
CI->RemoveClient(c); ///Removes the Client from existence
|
||||||
}
|
}
|
||||||
void OnConnect(Client*c){
|
void OnConnect(Client*c){
|
||||||
|
Assert(c);
|
||||||
info(Sec("Client connected"));
|
info(Sec("Client connected"));
|
||||||
c->SetID(OpenID());
|
c->SetID(OpenID());
|
||||||
info(Sec("Assigned ID ") + std::to_string(c->GetID()) + Sec(" to ") + c->GetName());
|
info(Sec("Assigned ID ") + std::to_string(c->GetID()) + Sec(" to ") + c->GetName());
|
||||||
@@ -82,4 +86,4 @@ void OnConnect(Client*c){
|
|||||||
Respond(c,"M"+MapName,true); //Send the Map on connect
|
Respond(c,"M"+MapName,true); //Send the Map on connect
|
||||||
info(c->GetName() + Sec(" : Connected"));
|
info(c->GetName() + Sec(" : Connected"));
|
||||||
TriggerLuaEvent(Sec("onPlayerJoining"),false,nullptr,new LuaArg{{c->GetID()}},false);
|
TriggerLuaEvent(Sec("onPlayerJoining"),false,nullptr,new LuaArg{{c->GetID()}},false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#endif // __linux
|
#endif // __linux
|
||||||
|
|
||||||
void STCPSend(Client* c, std::string Data) {
|
void STCPSend(Client* c, std::string Data) {
|
||||||
|
Assert(c);
|
||||||
if (c == nullptr)
|
if (c == nullptr)
|
||||||
return;
|
return;
|
||||||
ssize_t BytesSent = send(c->GetTCPSock(), Data.c_str(), size_t(Data.size()), 0);
|
ssize_t BytesSent = send(c->GetTCPSock(), Data.c_str(), size_t(Data.size()), 0);
|
||||||
@@ -28,6 +29,7 @@ void STCPSend(Client* c, std::string Data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SendFile(Client* c, const std::string& Name) {
|
void SendFile(Client* c, const std::string& Name) {
|
||||||
|
Assert(c);
|
||||||
info(c->GetName() + Sec(" requesting : ") + Name.substr(Name.find_last_of('/')));
|
info(c->GetName() + Sec(" requesting : ") + Name.substr(Name.find_last_of('/')));
|
||||||
struct stat Info {};
|
struct stat Info {};
|
||||||
if (stat(Name.c_str(), &Info) != 0) {
|
if (stat(Name.c_str(), &Info) != 0) {
|
||||||
@@ -61,6 +63,7 @@ void SendFile(Client* c, const std::string& Name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Parse(Client* c, const std::string& Packet) {
|
void Parse(Client* c, const std::string& Packet) {
|
||||||
|
Assert(c);
|
||||||
if (c == nullptr || Packet.empty())
|
if (c == nullptr || Packet.empty())
|
||||||
return;
|
return;
|
||||||
char Code = Packet.at(0), SubCode = 0;
|
char Code = Packet.at(0), SubCode = 0;
|
||||||
@@ -84,6 +87,7 @@ void Parse(Client* c, const std::string& Packet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool STCPRecv(Client* c) {
|
bool STCPRecv(Client* c) {
|
||||||
|
Assert(c);
|
||||||
if (c == nullptr)
|
if (c == nullptr)
|
||||||
return false;
|
return false;
|
||||||
char buf[200];
|
char buf[200];
|
||||||
@@ -109,6 +113,7 @@ bool STCPRecv(Client* c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SyncResources(Client* c) {
|
void SyncResources(Client* c) {
|
||||||
|
Assert(c);
|
||||||
if (c == nullptr)
|
if (c == nullptr)
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
void TCPSend(Client*c,const std::string&Data){
|
void TCPSend(Client*c,const std::string&Data){
|
||||||
|
Assert(c);
|
||||||
if(c == nullptr)return;
|
if(c == nullptr)return;
|
||||||
std::string Send = "\n" + Data.substr(0,Data.find(char(0))) + "\n";
|
std::string Send = "\n" + Data.substr(0,Data.find(char(0))) + "\n";
|
||||||
ssize_t Sent = send(c->GetTCPSock(), Send.c_str(), size_t(Send.size()), 0);
|
ssize_t Sent = send(c->GetTCPSock(), Send.c_str(), size_t(Send.size()), 0);
|
||||||
@@ -19,6 +20,7 @@ void TCPSend(Client*c,const std::string&Data){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void TCPHandle(Client*c,const std::string& data){
|
void TCPHandle(Client*c,const std::string& data){
|
||||||
|
Assert(c);
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
__try{
|
__try{
|
||||||
#endif // __WIN32
|
#endif // __WIN32
|
||||||
@@ -30,6 +32,7 @@ void TCPHandle(Client*c,const std::string& data){
|
|||||||
#endif // __WIN32
|
#endif // __WIN32
|
||||||
}
|
}
|
||||||
void TCPRcv(Client*c){
|
void TCPRcv(Client*c){
|
||||||
|
Assert(c);
|
||||||
if(c == nullptr || c->GetStatus() < 0)return;
|
if(c == nullptr || c->GetStatus() < 0)return;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
size_t len = 4096;
|
size_t len = 4096;
|
||||||
@@ -53,6 +56,7 @@ void TCPRcv(Client*c){
|
|||||||
TCPHandle(c,Buf);
|
TCPHandle(c,Buf);
|
||||||
}
|
}
|
||||||
void TCPClient(Client*c){
|
void TCPClient(Client*c){
|
||||||
|
Assert(c);
|
||||||
if(c->GetTCPSock() == -1){
|
if(c->GetTCPSock() == -1){
|
||||||
CI->RemoveClient(c);
|
CI->RemoveClient(c);
|
||||||
return;
|
return;
|
||||||
|
|||||||
+5
-3
@@ -11,9 +11,11 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
void DebugPrintTIDInternal(const std::string& what, const std::string& func) {
|
void DebugPrintTIDInternal(const std::string& what, const std::string& func) {
|
||||||
std::stringstream ss;
|
// we need to print to cout here as we might crash before all console output is handled,
|
||||||
ss << "Thread '" << std::this_thread::get_id() << "' in " << func << " is " << what;
|
// due to segfaults or asserts.
|
||||||
debug(ss.str());
|
#ifdef DEBUG
|
||||||
|
std::cout << "(debug build) Thread '" << std::this_thread::get_id() << "' in " << func << " is " << what << std::endl;
|
||||||
|
#endif // DEBUG
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getDate() {
|
std::string getDate() {
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
#include "Startup.h"
|
#include "Startup.h"
|
||||||
|
#include "Assert.h"
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
[[noreturn]] void loop(){
|
[[noreturn]] void loop(){
|
||||||
|
DebugPrintTID("test loop");
|
||||||
while(true){
|
while(true){
|
||||||
std::cout.flush();
|
std::cout.flush();
|
||||||
|
Assert(false);
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(600));
|
std::this_thread::sleep_for(std::chrono::milliseconds(600));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
DebugPrintTID("main");
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::thread t1(loop);
|
std::thread t1(loop);
|
||||||
t1.detach();
|
t1.detach();
|
||||||
#endif
|
#endif
|
||||||
|
Assert(false);
|
||||||
ConsoleInit();
|
ConsoleInit();
|
||||||
InitServer(argc,argv);
|
InitServer(argc,argv);
|
||||||
InitConfig();
|
InitConfig();
|
||||||
|
|||||||
Reference in New Issue
Block a user