QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgsreadwritelocker.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsreadwritelocker.cpp
3  -------------------------
4  begin : September 2018
5  copyright : (C) 2018 by Matthias Kuhn
6  email : [email protected]
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSREADWRITELOCKER_H
19 #define QGSREADWRITELOCKER_H
20 
21 #include "qgis_core.h"
22 
23 #include <QReadWriteLock>
24 
40 class CORE_EXPORT QgsReadWriteLocker
41 {
42  public:
43 
47  enum Mode
48  {
49  Read,
51  Unlocked
52  };
53 
57  QgsReadWriteLocker( QReadWriteLock &lock, Mode mode );
58 
63  void changeMode( Mode mode );
64 
69  void unlock();
70 
72 
73  private:
74  QReadWriteLock &mLock;
75  Mode mMode = Unlocked;
76 };
77 
78 #endif // QGSREADWRITELOCKER_H
Mode
A QReadWriteLock can be in 3 different modes, read, write or unlocked.
The QgsReadWriteLocker class is a convenience class that simplifies locking and unlocking QReadWriteL...