summaryrefslogtreecommitdiffhomepage
path: root/compat/copyable-mutex.hpp
blob: 46c6c88cf3d83d138c71eeac746dfe39d53c424a (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
#pragma once

#include <optional>

#include <QMutex>

#include "export.hpp"

class OTR_COMPAT_EXPORT mutex
{
    std::optional<QMutex> inner;

public:
    enum mode
    {
        recursive = QMutex::Recursive,
        normal = QMutex::NonRecursive,
    };

    mutex& operator=(const mutex& datum);
    mutex(const mutex& datum);
    explicit mutex(mode m = normal);

    QMutex* operator&() const;
    operator QMutex*() const;
    QMutex* operator->() const;
};