diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-08 07:01:44 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-10-08 07:01:44 +0300 |
commit | d5721b974a58ed5a26f33346dae728d93a7c1803 (patch) | |
tree | 2679ec39d8a44b5c3bdaf947d21881135460e7b7 /log.cpp | |
parent | 7df7cc0f3a8435c18e4491b04827deb47078b6d5 (diff) |
boost threads and mutexes, better error handling (thread's timeouts)
Diffstat (limited to 'log.cpp')
-rw-r--r-- | log.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -21,10 +21,12 @@ logtofile& logtofile::operator<<(TCHAR *buf) extern bool bDebugLog; if(bDebugLog) { + log_mutex.lock(); char *tmp = mir_utf8encodeW(buf); log.open(path, std::ios::app |std::ios::ate); log<<tmp; log.close(); + log_mutex.unlock(); mir_free(tmp); } return *this; @@ -34,10 +36,12 @@ logtofile& logtofile::operator<<(char *buf) extern bool bDebugLog; if(bDebugLog) { + log_mutex.lock(); char *tmp = mir_utf8encode(buf); log.open(path, std::ios::app |std::ios::ate); log<<tmp; log.close(); + log_mutex.unlock(); mir_free(tmp); } return *this; @@ -47,10 +51,12 @@ logtofile& logtofile::operator<<(string buf) extern bool bDebugLog; if(bDebugLog) { + log_mutex.lock(); char *tmp = mir_utf8encode(buf.c_str()); log.open(path, std::ios::app |std::ios::ate); log<<tmp; log.close(); + log_mutex.unlock(); mir_free(tmp); } return *this; @@ -60,10 +66,12 @@ logtofile& logtofile::operator<<(wstring buf) extern bool bDebugLog; if(bDebugLog) { + log_mutex.lock(); char *tmp = mir_utf8encodeW(buf.c_str()); log.open(path, std::ios::app |std::ios::ate); log<<tmp; log.close(); + log_mutex.unlock(); mir_free(tmp); } return *this; |