blob: 7c112c5eb4d41d8c9007f27af8448c66cf605637 (
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
|
#include "copyable-mutex.hpp"
mutex& mutex::operator=(const mutex& datum)
{
inner = nullptr;
inner = std::make_unique<QMutex>(datum->isRecursive()
? QMutex::Recursive
: QMutex::NonRecursive);
return *this;
}
mutex::mutex(const mutex& datum)
{
*this = datum;
}
mutex::mutex(mutex::mode m) :
inner(std::make_unique<QMutex>(static_cast<QMutex::RecursionMode>(int(m))))
{
}
QMutex* mutex::operator&() const
{
return *this;
}
QMutex* mutex::operator->() const
{
return *this;
}
mutex::operator QMutex*() const
{
return const_cast<QMutex*>(inner.get());
}
|