mCRL2
Loading...
Searching...
No Matches
mutex.h
Go to the documentation of this file.
1
// Author(s): Maurice Laveaux
2
// Copyright: see the accompanying file COPYING or copy at
3
// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4
//
5
// Distributed under the Boost Software License, Version 1.0.
6
// (See accompanying file LICENSE_1_0.txt or copy at
7
// http://www.boost.org/LICENSE_1_0.txt)
8
//
9
10
#ifndef MCRL2_UTILITIES_MUTEX_H_
11
#define MCRL2_UTILITIES_MUTEX_H_
12
13
#include <mutex>
14
15
#include "
mcrl2/utilities/configuration.h
"
16
17
namespace
mcrl2::utilities
18
{
19
22
class
mutex
23
{
24
public
:
25
void
lock
() {
26
if
constexpr
(
mcrl2::utilities::detail::GlobalThreadSafe
) {
27
m_mutex
.lock();
28
}
29
}
30
31
void
unlock
()
32
{
33
if
constexpr
(
mcrl2::utilities::detail::GlobalThreadSafe
) {
34
m_mutex
.unlock();
35
}
36
}
37
38
private
:
39
std::mutex
m_mutex
;
40
};
41
42
}
// namespace mcrl2::utilities
43
44
#endif
// MCRL2_UTILITIES_MUTEX_H_
mcrl2::utilities::mutex
This is simply an exclusive lock based on the standard library with the ability to perform no locks w...
Definition
mutex.h:23
mcrl2::utilities::mutex::lock
void lock()
Definition
mutex.h:25
mcrl2::utilities::mutex::unlock
void unlock()
Definition
mutex.h:31
mcrl2::utilities::mutex::m_mutex
std::mutex m_mutex
Definition
mutex.h:39
configuration.h
mcrl2::utilities::detail::GlobalThreadSafe
static constexpr bool GlobalThreadSafe
Enables thread safety for the whole toolset.
Definition
configuration.h:17
mcrl2::utilities
Definition
indexed_set.h:74
utilities
include
mcrl2
utilities
mutex.h
Generated by
1.9.7