blob: 57b0030d0bbb8b2a0e6bbcc1a9d966ee271b3d7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#pragma once
#include <QMutex>
class MyMutex {
private:
QMutex inner;
public:
QMutex* operator->() { return &inner; }
QMutex* operator->() const { return &const_cast<MyMutex*>(this)->inner; }
MyMutex operator=(const MyMutex& datum)
{
auto mode =
datum->isRecursive()
? QMutex::Recursive
: QMutex::NonRecursive;
return MyMutex(mode);
}
MyMutex(const MyMutex& datum)
{
*this = datum;
}
MyMutex(QMutex::RecursionMode mode = QMutex::NonRecursive) :
inner(mode)
{
}
QMutex* operator&() const
{
return const_cast<QMutex*>(&inner);
}
};
|