Browse Source

Make OutputDebugStringF thread-safe again (thanks ArtForz for catching)

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@182 1a98c847-1fd6-4fd8-948a-caf3550aa51b
miguelfreitas
gavinandresen 14 years ago
parent
commit
2f7a9997c8
  1. 6
      util.cpp

6
util.cpp

@ -145,6 +145,8 @@ int GetRandInt(int nMax) @@ -145,6 +145,8 @@ int GetRandInt(int nMax)
inline int OutputDebugStringF(const char* pszFormat, ...)
{
static CCriticalSection cs_OutputDebugStringF;
int ret = 0;
if (fPrintToConsole)
{
@ -155,6 +157,8 @@ inline int OutputDebugStringF(const char* pszFormat, ...) @@ -155,6 +157,8 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
va_end(arg_ptr);
}
else
{
CRITICAL_BLOCK(cs_OutputDebugStringF)
{
// print to debug.log
static FILE* fileout = NULL;
@ -181,12 +185,12 @@ inline int OutputDebugStringF(const char* pszFormat, ...) @@ -181,12 +185,12 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
fflush(fileout);
}
}
}
#ifdef __WXMSW__
if (fPrintToDebugger)
{
// accumulate a line at a time
static CCriticalSection cs_OutputDebugStringF;
CRITICAL_BLOCK(cs_OutputDebugStringF)
{
static char pszBuffer[50000];

Loading…
Cancel
Save