QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
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
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
40class CORE_EXPORT QgsReadWriteLocker
41{
42 public:
43
47 enum Mode
48 {
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#ifdef SIP_RUN
75 QgsReadWriteLocker &operator=( const QgsReadWriteLocker & );
76#endif
77
78 QReadWriteLock &mLock;
79 Mode mMode = Unlocked;
80};
81
82#endif // QGSREADWRITELOCKER_H
The QgsReadWriteLocker class is a convenience class that simplifies locking and unlocking QReadWriteL...
Mode
A QReadWriteLock can be in 3 different modes, read, write or unlocked.
@ Write
Lock for write.