diff options
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/cmdline.cpp | 3 | ||||
-rw-r--r-- | src/mir_core/miranda.cpp | 1 | ||||
-rw-r--r-- | src/mir_core/miranda.h | 1 | ||||
-rw-r--r-- | src/mir_core/threads.cpp | 30 |
4 files changed, 26 insertions, 9 deletions
diff --git a/src/mir_core/cmdline.cpp b/src/mir_core/cmdline.cpp index 6e112b7e14..acda692e0f 100644 --- a/src/mir_core/cmdline.cpp +++ b/src/mir_core/cmdline.cpp @@ -79,6 +79,9 @@ MIR_CORE_DLL(void) CmdLine_Parse(LPTSTR ptszCmdLine) p--; // the cycle will wipe this space automatically
}
+
+ if ( CmdLine_GetOption( _T("debug")))
+ g_bDebugMode = true;
}
MIR_CORE_DLL(LPCTSTR) CmdLine_GetOption(const TCHAR* ptszParameter)
diff --git a/src/mir_core/miranda.cpp b/src/mir_core/miranda.cpp index 73c5c9d0be..571bbb811a 100644 --- a/src/mir_core/miranda.cpp +++ b/src/mir_core/miranda.cpp @@ -34,6 +34,7 @@ HINSTANCE hInst = 0; HANDLE hStackMutex, hThreadQueueEmpty;
DWORD mir_tls = 0;
+bool g_bDebugMode = false;
/////////////////////////////////////////////////////////////////////////////////////////
// module init
diff --git a/src/mir_core/miranda.h b/src/mir_core/miranda.h index 93c7201e6a..1525c1b792 100644 --- a/src/mir_core/miranda.h +++ b/src/mir_core/miranda.h @@ -40,6 +40,7 @@ void UninitProtocols(); extern HINSTANCE hInst;
extern HWND hAPCWindow;
extern HANDLE hStackMutex, hThreadQueueEmpty;
+extern bool g_bDebugMode;
/**** modules.cpp **********************************************************************/
diff --git a/src/mir_core/threads.cpp b/src/mir_core/threads.cpp index ddce70df8b..af61aa82f9 100644 --- a/src/mir_core/threads.cpp +++ b/src/mir_core/threads.cpp @@ -110,12 +110,16 @@ void __cdecl forkthread_r(void *arg) void *cookie = fa->arg;
Thread_Push((HINSTANCE)callercode);
SetEvent(fa->hEvent);
- __try
- {
+ if (g_bDebugMode)
callercode(cookie);
- }
- __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
- {
+ else {
+ __try
+ {
+ callercode(cookie);
+ }
+ __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
+ {
+ }
}
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
@@ -150,15 +154,23 @@ unsigned __stdcall forkthreadex_r(void * arg) Thread_Push((HINSTANCE)threadcode, fa->owner);
SetEvent(fa->hEvent);
- __try
- {
+ if (g_bDebugMode) {
if (owner)
rc = threadcodeex(owner, cookie);
else
rc = threadcode(cookie);
}
- __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
- {
+ else {
+ __try
+ {
+ if (owner)
+ rc = threadcodeex(owner, cookie);
+ else
+ rc = threadcode(cookie);
+ }
+ __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
+ {
+ }
}
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|