diff options
author | John Hodge <tpg@mutabah.net> | 2018-01-28 19:19:30 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-01-28 19:19:30 +0800 |
commit | c4d7dfa0b6bb64924368f2eb73e12a2962183c22 (patch) | |
tree | 766c0e77a5296bef7b1fb10fd9486a28a337d148 /tools/minicargo/debug.cpp | |
parent | 976944f05ff7053fdcf7a9db055e0588dc5a1dd8 (diff) | |
download | mrust-c4d7dfa0b6bb64924368f2eb73e12a2962183c22.tar.gz |
All - mingw32 compilation changes
Diffstat (limited to 'tools/minicargo/debug.cpp')
-rw-r--r-- | tools/minicargo/debug.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/minicargo/debug.cpp b/tools/minicargo/debug.cpp index f6fca62e..a3fb9956 100644 --- a/tools/minicargo/debug.cpp +++ b/tools/minicargo/debug.cpp @@ -5,6 +5,9 @@ * debug.cpp * - Debugging helpers */ +#if defined(__MINGW32__) +# define DISABLE_MULTITHREAD // Mingw32 doesn't have c++11 threads +#endif #include <set> #include <iostream> #include "debug.h" @@ -13,7 +16,9 @@ static int giIndentLevel = 0; static const char* gsDebugPhase = ""; static ::std::set<::std::string> gmDisabledDebug; +#ifndef DISABLE_MULTITHREAD static ::std::mutex gDebugLock; +#endif void Debug_SetPhase(const char* phase_name) { @@ -33,7 +38,9 @@ void Debug_Print(::std::function<void(::std::ostream& os)> cb) { if( !Debug_IsEnabled() ) return ; +#ifndef DISABLE_MULTITHREAD ::std::unique_lock<::std::mutex> _lh { gDebugLock }; +#endif ::std::cout << gsDebugPhase << "- "; for(auto i = giIndentLevel; i --; ) @@ -45,7 +52,9 @@ void Debug_EnterScope(const char* name, dbg_cb_t cb) { if( !Debug_IsEnabled() ) return ; +#ifndef DISABLE_MULTITHREAD ::std::unique_lock<::std::mutex> _lh { gDebugLock }; +#endif ::std::cout << gsDebugPhase << "- "; for(auto i = giIndentLevel; i --; ) @@ -59,7 +68,9 @@ void Debug_LeaveScope(const char* name, dbg_cb_t cb) { if( !Debug_IsEnabled() ) return ; +#ifndef DISABLE_MULTITHREAD ::std::unique_lock<::std::mutex> _lh { gDebugLock }; +#endif ::std::cout << gsDebugPhase << "- "; giIndentLevel --; |