LCOV - code coverage report
Current view: top level - utilities/include/mcrl2/utilities/detail - atomic_wrapper.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 12 12 100.0 %
Date: 2024-05-04 03:44:52 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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         653 :   atomic_wrapper()
      22         653 :    : std::atomic<T>(0)
      23         653 :   {}
      24             : 
      25     2325810 :   atomic_wrapper(const T t)
      26     2325810 :    : std::atomic<T>(t)
      27     2325810 :   {}
      28             : 
      29     3272407 :   atomic_wrapper(const atomic_wrapper<T>& other)
      30     3348644 :     : std::atomic<T>(other.load())
      31     3272407 :   {}
      32             : 
      33     1225473 :   atomic_wrapper& operator=(const atomic_wrapper<T>& other)
      34             :   {
      35     1242739 :     this->store(other.load());
      36     1225473 :     return *this;
      37             :   }
      38             : };
      39             : 
      40             : } // namespace mcrl2::utilities::detail
      41             : 
      42             : #endif // MCRL2_UTILITIES_DETAIL_ATOMIC_WRAPPER_H_

Generated by: LCOV version 1.14