summaryrefslogtreecommitdiffhomepage
path: root/compat/copyable-mutex.cpp
blob: dde84c83baf5fe1d3b65d6af5f75fe435f414783 (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
#include "copyable-mutex.hpp"

mutex& mutex::operator=(const mutex& datum)
{
    inner.emplace(datum->isRecursive() ? QMutex::Recursive : QMutex::NonRecursive);
    return *this;
}

mutex::mutex(const mutex& datum)
{
    *this = datum;
}

mutex::mutex(mutex::mode m) :
    inner { std::in_place, 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.value());
}