annotate DEPENDENCIES/generic/include/boost/asio/detail/gcc_sync_fenced_block.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //
Chris@16 2 // detail/gcc_sync_fenced_block.hpp
Chris@16 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris@16 4 //
Chris@101 5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Chris@16 6 //
Chris@16 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 //
Chris@16 10
Chris@16 11 #ifndef BOOST_ASIO_DETAIL_GCC_SYNC_FENCED_BLOCK_HPP
Chris@16 12 #define BOOST_ASIO_DETAIL_GCC_SYNC_FENCED_BLOCK_HPP
Chris@16 13
Chris@16 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 15 # pragma once
Chris@16 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 17
Chris@16 18 #include <boost/asio/detail/config.hpp>
Chris@16 19
Chris@16 20 #if defined(__GNUC__) \
Chris@16 21 && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \
Chris@16 22 && !defined(__INTEL_COMPILER) && !defined(__ICL) \
Chris@16 23 && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__)
Chris@16 24
Chris@16 25 #include <boost/asio/detail/push_options.hpp>
Chris@16 26
Chris@16 27 namespace boost {
Chris@16 28 namespace asio {
Chris@16 29 namespace detail {
Chris@16 30
Chris@16 31 class gcc_sync_fenced_block
Chris@16 32 : private noncopyable
Chris@16 33 {
Chris@16 34 public:
Chris@16 35 enum half_or_full_t { half, full };
Chris@16 36
Chris@16 37 // Constructor.
Chris@16 38 explicit gcc_sync_fenced_block(half_or_full_t)
Chris@16 39 : value_(0)
Chris@16 40 {
Chris@16 41 __sync_lock_test_and_set(&value_, 1);
Chris@16 42 }
Chris@16 43
Chris@16 44 // Destructor.
Chris@16 45 ~gcc_sync_fenced_block()
Chris@16 46 {
Chris@16 47 __sync_lock_release(&value_);
Chris@16 48 }
Chris@16 49
Chris@16 50 private:
Chris@16 51 int value_;
Chris@16 52 };
Chris@16 53
Chris@16 54 } // namespace detail
Chris@16 55 } // namespace asio
Chris@16 56 } // namespace boost
Chris@16 57
Chris@16 58 #include <boost/asio/detail/pop_options.hpp>
Chris@16 59
Chris@16 60 #endif // defined(__GNUC__)
Chris@16 61 // && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4))
Chris@16 62 // && !defined(__INTEL_COMPILER) && !defined(__ICL)
Chris@16 63 // && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__)
Chris@16 64
Chris@16 65 #endif // BOOST_ASIO_DETAIL_GCC_SYNC_FENCED_BLOCK_HPP