TermOx
include
termox
common
lockable.hpp
1
#ifndef TERMOX_COMMON_LOCKABLE_HPP
2
#define TERMOX_COMMON_LOCKABLE_HPP
3
#include <mutex>
4
5
namespace
ox {
6
7
template
<
typename
Mutex = std::mutex>
8
class
Lockable
{
9
public
:
10
[[nodiscard]]
auto
lock()
const
-> std::scoped_lock<Mutex>
11
{
12
return
std::scoped_lock{mtx_};
13
}
14
15
[[nodiscard]]
auto
mutex()
const
-> Mutex& {
return
mtx_; }
16
17
private
:
18
mutable
Mutex mtx_;
19
};
20
21
}
// namespace ox
22
#endif
// TERMOX_COMMON_LOCKABLE_HPP
ox::Lockable
Definition:
lockable.hpp:8
Generated by
1.9.1