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
15{
16
17// The purpose of this wrapper is to allow copying of atomics.
18template<typename T>
19struct atomic_wrapper: public std::atomic<T>
20{
22 : std::atomic<T>(0)
23 {}
24
25 atomic_wrapper(const T t)
26 : std::atomic<T>(t)
27 {}
28
30 : std::atomic<T>(other.load())
31 {}
32
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_
STL namespace.
atomic_wrapper & operator=(const atomic_wrapper< T > &other)
atomic_wrapper(const atomic_wrapper< T > &other)