diff options
author | sb <sb@openoffice.org> | 2010-12-14 13:30:07 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-12-14 13:30:07 +0100 |
commit | 5a9b9d77de92117e13208d0c15bbfc120697e0b7 (patch) | |
tree | 934937dbbed0992db9e65aea67f72c9e0a440acd /sal/osl/w32/diagnose.c | |
parent | 4eb067284ed88651b0a8c89813515f0b88b2bb04 (diff) |
sb135: #i116050# make osl_trace output atomic
Diffstat (limited to 'sal/osl/w32/diagnose.c')
-rwxr-xr-x[-rw-r--r--] | sal/osl/w32/diagnose.c | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/sal/osl/w32/diagnose.c b/sal/osl/w32/diagnose.c index b46bff44b73c..9c75e4502743 100644..100755 --- a/sal/osl/w32/diagnose.c +++ b/sal/osl/w32/diagnose.c @@ -32,6 +32,8 @@ #include <osl/diagnose.h> #include <osl/thread.h> +#include "printtrace.h" + #define NO_DEBUG_CRT static pfunc_osl_printDebugMessage _pPrintDebugMessage = NULL; @@ -61,46 +63,21 @@ void SAL_CALL osl_breakDebug(void) DebugBreak(); } - - -/* Uncomment this define to get profiling time output */ -/* #define OSL_PROFILING */ -/* comment this define to stop output thread identifier*/ -#define OSL_TRACE_THREAD 1 -void SAL_CALL osl_trace(const sal_Char* lpszFormat, ...) -{ +void osl_trace(char const * pszFormat, ...) { va_list args; - int written = 0; - - va_start(args, lpszFormat); - -#if defined(OSL_PROFILING) - fprintf(stderr, "time : %06lu : ", osl_getGlobalTimer() ); -#else -#if defined(OSL_TRACE_THREAD) - fprintf(stderr,"Thread: %6d :",osl_getThreadIdentifier(NULL)); -#else - fprintf(stderr,"Trace Message : "); -#endif -#endif - + va_start(args, pszFormat); if ( IsDebuggerPresent() ) { sal_Char szMessage[512]; - written = _vsnprintf( szMessage, sizeof(szMessage) - 2, lpszFormat, args ); + int written = _vsnprintf( + szMessage, sizeof(szMessage) - 2, pszFormat, args ); if ( written == -1 ) written = sizeof(szMessage) - 2; szMessage[ written++ ] = '\n'; szMessage[ written ] = 0; OutputDebugString( szMessage ); } - - vfprintf(stderr,lpszFormat, args); - - fprintf(stderr,"\n"); - - fflush(stderr); - + printTrace((unsigned long) _getpid(), pszFormat, args); va_end(args); } |