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

Delta Between Two Patch Sets: src/shared/CriticalSection.h

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:
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/PluginFilter.cpp ('k') | src/shared/Utils.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
(no file at all)
1 #ifndef CRITICAL_SECTION_H
2 #define CRITICAL_SECTION_H
3
4 class CriticalSection
5 {
6 public:
7 CriticalSection()
8 {
9 InitializeCriticalSection(&section);
10 }
11
12 ~CriticalSection()
13 {
14 DeleteCriticalSection(&section);
15 }
16
17 class Lock
18 {
19 public:
20 Lock(CriticalSection& cs)
21 : section(&cs.section)
22 {
23 EnterCriticalSection(section);
24 }
25
26 ~Lock()
27 {
28 LeaveCriticalSection(section);
29 }
30 private:
31 LPCRITICAL_SECTION section;
32 Lock(const Lock&);
33 Lock& operator=(const Lock&);
34 };
35 private:
36 CRITICAL_SECTION section;
37 CriticalSection(const CriticalSection&);
38 CriticalSection& operator=(const CriticalSection&);
39 };
40 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld