BVB Source Codes

mars Show atomic_flag.hpp Source code

Return Download mars: download atomic_flag.hpp Source code - Download mars Source code - Type:.hpp
  1. /*
  2.  * Distributed under the Boost Software License, Version 1.0.
  3.  * (See accompanying file LICENSE_1_0.txt or copy at
  4.  * http://www.boost.org/LICENSE_1_0.txt)
  5.  *
  6.  * Copyright (c) 2014 Andrey Semashev
  7.  */
  8. /*!
  9.  * \file   atomic/detail/atomic_flag.hpp
  10.  *
  11.  * This header contains interface definition of \c atomic_flag.
  12.  */
  13.  
  14. #ifndef BOOST_ATOMIC_DETAIL_ATOMIC_FLAG_HPP_INCLUDED_
  15. #define BOOST_ATOMIC_DETAIL_ATOMIC_FLAG_HPP_INCLUDED_
  16.  
  17. #include <boost/assert.hpp>
  18. #include <boost/memory_order.hpp>
  19. #include <boost/atomic/detail/config.hpp>
  20. #include <boost/atomic/detail/operations_lockfree.hpp>
  21.  
  22. #ifdef BOOST_HAS_PRAGMA_ONCE
  23. #pragma once
  24. #endif
  25.  
  26. /*
  27.  * IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE,
  28.  *                      see comment for convert_memory_order_to_gcc in ops_gcc_atomic.hpp.
  29.  */
  30.  
  31. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost {
  32. namespace atomics {
  33.  
  34. #if defined(BOOST_NO_CXX11_CONSTEXPR) || defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
  35. #define BOOST_ATOMIC_NO_ATOMIC_FLAG_INIT
  36. #else
  37. #define BOOST_ATOMIC_FLAG_INIT {}
  38. #endif
  39.  
  40. struct atomic_flag
  41. {
  42.     typedef atomics::detail::operations< 1u, false > operations;
  43.     typedef operations::storage_type storage_type;
  44.  
  45.     operations::aligned_storage_type m_storage;
  46.  
  47.     BOOST_FORCEINLINE BOOST_CONSTEXPR atomic_flag() BOOST_NOEXCEPT : m_storage(0)
  48.     {
  49.     }
  50.  
  51.     BOOST_FORCEINLINE bool test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
  52.     {
  53.         return operations::test_and_set(m_storage.value, order);
  54.     }
  55.  
  56.     BOOST_FORCEINLINE void clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
  57.     {
  58.         BOOST_ASSERT(order != memory_order_acquire);
  59.         BOOST_ASSERT(order != memory_order_acq_rel);
  60.         operations::clear(m_storage.value, order);
  61.     }
  62.  
  63.     BOOST_DELETED_FUNCTION(atomic_flag(atomic_flag const&))
  64.     BOOST_DELETED_FUNCTION(atomic_flag& operator= (atomic_flag const&))
  65. };
  66.  
  67. } // namespace atomics
  68. } // namespace mars_boost
  69.  
  70. #endif // BOOST_ATOMIC_DETAIL_ATOMIC_FLAG_HPP_INCLUDED_
  71.  
downloadatomic_flag.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top