Rewritten most of the code for multithreading; still not 100%, but getting there. If this commit proves to be too problematic, we can always undo it.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@251 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -17,6 +17,22 @@
|
||||
|
||||
|
||||
|
||||
/// If defined, a thorough leak finder will be used (debug MSVC only); leaks will be output to the Output window
|
||||
#define ENABLE_LEAK_FINDER
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)
|
||||
#define XML_LEAK_FINDER
|
||||
#include "LeakFinder.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ShowCrashReport(int)
|
||||
{
|
||||
@@ -27,17 +43,31 @@ void ShowCrashReport(int)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
#ifdef _DEBUG
|
||||
|
||||
#if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)
|
||||
InitLeakFinder();
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
|
||||
#endif
|
||||
|
||||
// _X: The simple built-in CRT leak finder - simply break when allocating the Nth block ({N} is listed in the leak output)
|
||||
// Only useful when the leak is in the same sequence all the time
|
||||
// _CrtSetBreakAlloc(85950);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifndef _DEBUG
|
||||
std::signal(SIGSEGV, ShowCrashReport);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
@@ -53,12 +83,17 @@ int main( int argc, char **argv )
|
||||
LOGERROR("Unknown exception!");
|
||||
}
|
||||
|
||||
#if USE_SQUIRREL
|
||||
#if USE_SQUIRREL
|
||||
SquirrelVM::Shutdown();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
_CrtDumpMemoryLeaks();
|
||||
#endif
|
||||
#if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)
|
||||
DeinitLeakFinder();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user