Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/engine/Debug.cpp

Issue 11012013: Hanging resolved (critical sections unlocking) (Closed)
Left Patch Set: Using CriticalSection class instead Created June 17, 2013, 10:03 a.m.
Right Patch Set: Comments addressed Created June 25, 2013, 11:56 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/plugin/PluginFilter.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #include <fstream> 1 #include <fstream>
2 #include <stdio.h> 2 #include <stdio.h>
3 #include <sstream> 3 #include <sstream>
4 #include <Windows.h> 4 #include <Windows.h>
5 5
6 #include "../shared/Utils.h" 6 #include "../shared/Utils.h"
7 #include "../shared/CriticalSection.h"
7 8
8 #include "Debug.h" 9 #include "Debug.h"
9 10
10 #ifdef _DEBUG 11 #ifdef _DEBUG
11 12
12 CriticalSection debugLock; 13 namespace
Wladimir Palant 2013/06/17 12:57:24 IMHO this should be kept inside the anonymous name
13 14 {
15 CriticalSection debugLock;
16 };
14 void Debug(const std::string& text) 17 void Debug(const std::string& text)
15 { 18 {
16 SYSTEMTIME st; 19 SYSTEMTIME st;
17 ::GetSystemTime(&st); 20 ::GetSystemTime(&st);
18 21
19 char timeBuf[14]; 22 char timeBuf[14];
20 _snprintf_s(timeBuf, _TRUNCATE, "%02i:%02i:%02i.%03i", st.wHour, st.wMinute, s t.wSecond, st.wMilliseconds); 23 _snprintf_s(timeBuf, _TRUNCATE, "%02i:%02i:%02i.%03i", st.wHour, st.wMinute, s t.wSecond, st.wMilliseconds);
21 24
22 std::wstring filePath = GetAppDataPath() + L"\\debug_engine.txt"; 25 std::wstring filePath = GetAppDataPath() + L"\\debug_engine.txt";
23 26
(...skipping 12 matching lines...) Expand all
36 39
37 void DebugException(const std::exception& exception) 40 void DebugException(const std::exception& exception)
38 { 41 {
39 Debug(std::string("An exception occurred: ") + exception.what()); 42 Debug(std::string("An exception occurred: ") + exception.what());
40 } 43 }
41 #else 44 #else
42 void Debug(const std::string& text) {} 45 void Debug(const std::string& text) {}
43 void DebugLastError(const std::string& message) {} 46 void DebugLastError(const std::string& message) {}
44 void DebugException(const std::exception& exception) {} 47 void DebugException(const std::exception& exception) {}
45 #endif // _DEBUG 48 #endif // _DEBUG
LEFTRIGHT

Powered by Google App Engine
This is Rietveld