File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -53,20 +53,25 @@ CriticalSectionLocker::CriticalSectionLocker(CriticalSectionLock lock)
53
53
{
54
54
CriticalSectionInitializeLocks (); // initialize critical sections
55
55
gLock = lock;
56
+
56
57
EnterCriticalSection (&locks[gLock ]);
58
+ Locked = true ;
57
59
}
58
60
59
61
CriticalSectionLocker::~CriticalSectionLocker ()
60
62
{
61
- LeaveCriticalSection (&locks[gLock ]);
63
+ if (Locked)
64
+ LeaveCriticalSection (&locks[gLock ]);
62
65
}
63
66
64
67
void CriticalSectionLocker::unlock ()
65
68
{
69
+ Locked = false ;
66
70
LeaveCriticalSection (&locks[gLock ]);
67
71
}
68
72
69
73
void CriticalSectionLocker::relock ()
70
74
{
71
75
EnterCriticalSection (&locks[gLock ]);
76
+ Locked = true ;
72
77
}
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ class CriticalSectionLocker
46
46
47
47
private:
48
48
CriticalSectionLock gLock ;
49
+ bool Locked;
49
50
};
50
51
51
52
#endif // _THREADING_H
You can’t perform that action at this time.
0 commit comments