Mobile API Reference  MicroStrategy 2019
CriticalSectionImpl.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : CriticalSectionImpl.h
3 // AUTHOR : Jing Ning
4 // CREATION : 9/26/01
5 // Copyright (C) MicroStrategy Incorporated 2001
6 //==============================================================================================
7 #ifndef MSynch_CriticalSectionImpl_h
8 #define MSynch_CriticalSectionImpl_h
9 
10 #include "PDCHeader/PDCvector"
11 
12 #include "../LockCategories.h"
13 #include "../CriticalSection.h"
14 
15 #include "SynchObject.h"
16 #include "../ProtectedSource/InprocessRecursiveMutex.h"
17 
18 namespace MSynch
19 {
21  public CriticalSection,
22  public SynchObject
23  {
24  public:
26  void Delete() throw();
27  void SetLockCategory(EnumDSSLockStackCategory iLockCatagory);
28 
30  bool IsLocked() const;
31 
32  void InitState(EnumDSSLockStackCategory iLockCategory);
33  static CriticalSectionImpl* GetCS(EnumDSSLockStackCategory iLockCategory);
34  static void ReleaseCS(CriticalSectionImpl* cs);
35 
36  protected:
37  virtual void Lock();
38  virtual void Unlock() throw();
39 
40  private:
41 
42  EnumDSSLockStackCategory mLockCategory;
43 
44  // use our mutex as underlying implementation
46 
47  bool mbLockHasBeenCalled;
48  bool mbCategoryHasBeenChanged;
49 
50  // mnLastOccupyingThreadID is for debugging purposes
51  // read this member to find out which thread is holding the lock
52  unsigned int mnLastOccupyingThreadID;
53  // mnOccupiedCount is for debugging purposes
54  // it counts how many times the lock has been entered (without leaving) by the same thread
55  unsigned int mnOccupiedCount;
56 
57 
58  public:
61  };
62 }
63 
64 #endif // MSynch_CriticalSectionImpl_h
void InitState(EnumDSSLockStackCategory iLockCategory)
Definition: CriticalSectionImpl.h:20
Definition: InprocessRecursiveMutex.h:25
static void ReleaseCS(CriticalSectionImpl *cs)
Definition: ReferenceCountedImpl.h:18
Definition: SynchObject.h:16
CriticalSectionImpl(EnumDSSLockStackCategory iLockCategory)
virtual void Exception_unsafe_Lock__which_should_NOT_be_used_because_of_imminent_deadlocks__Use_SmartLock_instead()
void SetLockCategory(EnumDSSLockStackCategory iLockCatagory)
SetLockCategory for "late category binding".
CriticalSection allows only one thread at a time to pass.
Definition: CriticalSection.h:24
virtual void Exception_unsafe_Unlock__which_should_NOT_be_used_because_of_imminent_deadlocks__Use_SmartLock_instead()
static CriticalSectionImpl * GetCS(EnumDSSLockStackCategory iLockCategory)
virtual void Unlock()
leave the critical section, any waiting thread may enter it now
EnumDSSLockStackCategory
Definition: LockCategories.h:32