HCE project C++ developers source code library  1.1.1
HCE project developer library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ReaderWriterGuards.h
Go to the documentation of this file.
1 #ifndef READER_WRITER_GUARDS_H
2 #define READER_WRITER_GUARDS_H
3 
4 #include <ReaderWriter.h>
5 
7 {
8  public:
9  ReaderGuard(ReaderWriter *readerWriter)
10  {
11  this->readerWriter = readerWriter;
12  readerWriter->readLock();
13  }
15  {
16  readerWriter->unlock();
17  }
18 
19  private:
20  ReaderWriter *readerWriter;
21 };
22 
23 
25 {
26  public:
27  WriterGuard(ReaderWriter *readerWriter)
28  {
29  this->readerWriter = readerWriter;
30  readerWriter->writeLock();
31  }
33  {
34  readerWriter->unlock();
35  }
36 
37  private:
38  ReaderWriter *readerWriter;
39 };
40 #endif