Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / detail / win_fenced_block.hpp @ 2486

History | View | Annotate | Download (2 kB)

1 2486 sjacqu01
//
2 2486 sjacqu01
// detail/win_fenced_block.hpp
3 2486 sjacqu01
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 2486 sjacqu01
//
5 2486 sjacqu01
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 2486 sjacqu01
//
7 2486 sjacqu01
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8 2486 sjacqu01
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 2486 sjacqu01
//
10 2486 sjacqu01
11 2486 sjacqu01
#ifndef BOOST_ASIO_DETAIL_WIN_FENCED_BLOCK_HPP
12 2486 sjacqu01
#define BOOST_ASIO_DETAIL_WIN_FENCED_BLOCK_HPP
13 2486 sjacqu01
14 2486 sjacqu01
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 2486 sjacqu01
# pragma once
16 2486 sjacqu01
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 2486 sjacqu01
18 2486 sjacqu01
#include <boost/asio/detail/config.hpp>
19 2486 sjacqu01
20 2486 sjacqu01
#if defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE)
21 2486 sjacqu01
22 2486 sjacqu01
#include <boost/asio/detail/socket_types.hpp>
23 2486 sjacqu01
24 2486 sjacqu01
#include <boost/asio/detail/push_options.hpp>
25 2486 sjacqu01
26 2486 sjacqu01
namespace boost {
27 2486 sjacqu01
namespace asio {
28 2486 sjacqu01
namespace detail {
29 2486 sjacqu01
30 2486 sjacqu01
class win_fenced_block
31 2486 sjacqu01
  : private noncopyable
32 2486 sjacqu01
{
33 2486 sjacqu01
public:
34 2486 sjacqu01
  enum half_t { half };
35 2486 sjacqu01
  enum full_t { full };
36 2486 sjacqu01
37 2486 sjacqu01
  // Constructor for a half fenced block.
38 2486 sjacqu01
  explicit win_fenced_block(half_t)
39 2486 sjacqu01
  {
40 2486 sjacqu01
  }
41 2486 sjacqu01
42 2486 sjacqu01
  // Constructor for a full fenced block.
43 2486 sjacqu01
  explicit win_fenced_block(full_t)
44 2486 sjacqu01
  {
45 2486 sjacqu01
#if defined(__BORLANDC__)
46 2486 sjacqu01
    LONG barrier = 0;
47 2486 sjacqu01
    ::InterlockedExchange(&barrier, 1);
48 2486 sjacqu01
#elif defined(BOOST_ASIO_MSVC) \
49 2486 sjacqu01
  && ((BOOST_ASIO_MSVC < 1400) || !defined(MemoryBarrier))
50 2486 sjacqu01
# if defined(_M_IX86)
51 2486 sjacqu01
#  pragma warning(push)
52 2486 sjacqu01
#  pragma warning(disable:4793)
53 2486 sjacqu01
    LONG barrier;
54 2486 sjacqu01
    __asm { xchg barrier, eax }
55 2486 sjacqu01
#  pragma warning(pop)
56 2486 sjacqu01
# endif // defined(_M_IX86)
57 2486 sjacqu01
#else
58 2486 sjacqu01
    MemoryBarrier();
59 2486 sjacqu01
#endif
60 2486 sjacqu01
  }
61 2486 sjacqu01
62 2486 sjacqu01
  // Destructor.
63 2486 sjacqu01
  ~win_fenced_block()
64 2486 sjacqu01
  {
65 2486 sjacqu01
#if defined(__BORLANDC__)
66 2486 sjacqu01
    LONG barrier = 0;
67 2486 sjacqu01
    ::InterlockedExchange(&barrier, 1);
68 2486 sjacqu01
#elif defined(BOOST_ASIO_MSVC) \
69 2486 sjacqu01
  && ((BOOST_ASIO_MSVC < 1400) || !defined(MemoryBarrier))
70 2486 sjacqu01
# if defined(_M_IX86)
71 2486 sjacqu01
#  pragma warning(push)
72 2486 sjacqu01
#  pragma warning(disable:4793)
73 2486 sjacqu01
    LONG barrier;
74 2486 sjacqu01
    __asm { xchg barrier, eax }
75 2486 sjacqu01
#  pragma warning(pop)
76 2486 sjacqu01
# endif // defined(_M_IX86)
77 2486 sjacqu01
#else
78 2486 sjacqu01
    MemoryBarrier();
79 2486 sjacqu01
#endif
80 2486 sjacqu01
  }
81 2486 sjacqu01
};
82 2486 sjacqu01
83 2486 sjacqu01
} // namespace detail
84 2486 sjacqu01
} // namespace asio
85 2486 sjacqu01
} // namespace boost
86 2486 sjacqu01
87 2486 sjacqu01
#include <boost/asio/detail/pop_options.hpp>
88 2486 sjacqu01
89 2486 sjacqu01
#endif // defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE)
90 2486 sjacqu01
91 2486 sjacqu01
#endif // BOOST_ASIO_DETAIL_WIN_FENCED_BLOCK_HPP