mCRL2
Loading...
Searching...
No Matches
atomic_wrapper.h
Go to the documentation of this file.
1
// Author(s): Jan Friso
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
#ifndef MCRL2_UTILITIES_DETAIL_ATOMIC_WRAPPER_H_
10
#define MCRL2_UTILITIES_DETAIL_ATOMIC_WRAPPER_H_
11
12
#include <atomic>
13
14
namespace
mcrl2::utilities::detail
15
{
16
17
// The purpose of this wrapper is to allow copying of atomics.
18
template
<
typename
T>
19
struct
atomic_wrapper
:
public
std::atomic<T>
20
{
21
atomic_wrapper
()
22
:
std
::atomic<T>(0)
23
{}
24
25
atomic_wrapper
(
const
T t)
26
:
std
::atomic<T>(t)
27
{}
28
29
atomic_wrapper
(
const
atomic_wrapper<T>
& other)
30
:
std
::atomic<T>(other.load())
31
{}
32
33
atomic_wrapper
&
operator=
(
const
atomic_wrapper<T>
& other)
34
{
35
this->store(other.load());
36
return
*
this
;
37
}
38
};
39
40
}
// namespace mcrl2::utilities::detail
41
42
#endif
// MCRL2_UTILITIES_DETAIL_ATOMIC_WRAPPER_H_
mcrl2::utilities::detail
Definition
indexed_set.h:76
std
STL namespace.
mcrl2::utilities::detail::atomic_wrapper
Definition
atomic_wrapper.h:20
mcrl2::utilities::detail::atomic_wrapper::atomic_wrapper
atomic_wrapper()
Definition
atomic_wrapper.h:21
mcrl2::utilities::detail::atomic_wrapper::operator=
atomic_wrapper & operator=(const atomic_wrapper< T > &other)
Definition
atomic_wrapper.h:33
mcrl2::utilities::detail::atomic_wrapper::atomic_wrapper
atomic_wrapper(const atomic_wrapper< T > &other)
Definition
atomic_wrapper.h:29
mcrl2::utilities::detail::atomic_wrapper::atomic_wrapper
atomic_wrapper(const T t)
Definition
atomic_wrapper.h:25
utilities
include
mcrl2
utilities
detail
atomic_wrapper.h
Generated by
1.9.7