Mobile API Reference  MicroStrategy 2019
RWLock.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : RWLock.h
3 // AUTHOR : Jing Ning
4 // CREATION : 9/26/01
5 // Copyright (C) MicroStrategy Incorporated 2001
6 //==============================================================================================
7 #ifndef MSynch_RWLock_h
8 #define MSynch_RWLock_h
9 
10 #include "Base/Defines/NoCopy.h"
11 #include "Base/Defines/StrongPtr.h"
13 
14 #include "Synch.h"
15 #include "LockCategories.h"
17 
18 namespace MSynch
19 {
23  class RWLock
24  {
25  public:
26 
29 
32  public MBase::NoCopy
33  {
34  public:
35  ReadSmartLock(RWLock& irRWLock, bool ibLocking = true); // bxia: add second param to control whether we lock in constructor
36  ~ReadSmartLock() throw();
37 
44  void Lock();
45  void Unlock() throw();
46 
47  private:
48  RWLock& mrRWLock;
49  bool mbLocked;
50  };
51 
54  public MBase::NoCopy
55  {
56  public:
57  WriteSmartLock(RWLock& irRWLock, bool ibLocking = true); // bxia: add second param to control whether we lock in constructor
58  ~WriteSmartLock() throw();
59 
66  void Lock();
67  void Unlock() throw();
68 
69  private:
70  RWLock& mrRWLock;
71  bool mbLocked;
72  };
73  virtual void Delete() throw() = 0;
74 
75  protected:
76  friend class ReadSmartLock;
77  friend class WriteSmartLock;
78 
85  virtual void ReadLock() = 0;
86 
93  virtual void WriteLock() = 0;
94 
95  virtual void ReadUnlock() throw() = 0;
96  virtual void WriteUnlock() throw() = 0;
97  };
98 
99  // this typedef is obsolete
100  typedef RWLock::Ptr RWLockPtr;
101 
103 
107  public MBase::BaseException
108  {
109  };
110 }
111 
112 #endif // MSynch_RWLock_h
virtual void WriteLock()=0
MBase::StrongPtr< RWLock, MBase::DeleteOperatorGeneric< RWLock > > Ptr
Definition: RWLock.h:27
friend class WriteSmartLock
Definition: RWLock.h:77
ReadSmartLock is intended to be created in the stack only.
Definition: RWLock.h:31
Definition: ReferenceCountedImpl.h:18
Message BaseException
Definition: BaseException.h:37
virtual void ReadUnlock()=0
#define DLL_SYNCH_EXIM
Definition: Synch.h:17
virtual void ReadLock()=0
friend class ReadSmartLock
Definition: RWLock.h:76
DLL_SYNCH_EXIM RWLock * CreateRWLock(EnumDSSLockStackCategory iLockCategory=DssLkStkCatNotNestingLock)
Definition: RWLock.h:23
MBase::ReturnPtr< RWLock, MBase::DeleteOperatorGeneric< RWLock > > ReturnPtr
Definition: RWLock.h:28
Definition: Allocator.h:47
Definition: LockCategories.h:35
Definition: StrongPtr.h:50
virtual void WriteUnlock()=0
virtual void Delete()=0
Definition: RWLock.h:106
WriteSmartLock is intended to be created in the stack only.
Definition: RWLock.h:53
Definition: NoCopy.h:21
EnumDSSLockStackCategory
Definition: LockCategories.h:32
Definition: ReturnPtr.h:22