]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/thread/include/boost/thread/win32/interlocked_read.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / thread / include / boost / thread / win32 / interlocked_read.hpp
CommitLineData
7c673cae
FG
1#ifndef BOOST_THREAD_DETAIL_INTERLOCKED_READ_WIN32_HPP
2#define BOOST_THREAD_DETAIL_INTERLOCKED_READ_WIN32_HPP
3
4// interlocked_read_win32.hpp
5//
6// (C) Copyright 2005-8 Anthony Williams
7// (C) Copyright 2012 Vicente J. Botet Escriba
8//
9// Distributed under the Boost Software License, Version 1.0. (See
10// accompanying file LICENSE_1_0.txt or copy at
11// http://www.boost.org/LICENSE_1_0.txt)
12
13#include <boost/detail/interlocked.hpp>
14#include <boost/thread/detail/config.hpp>
15
16#include <boost/config/abi_prefix.hpp>
17
18#ifdef BOOST_MSVC
19
20namespace boost
21{
22 namespace detail
23 {
24 // Since VS2005 volatile reads always acquire
25 inline long interlocked_read_acquire(long volatile* x) BOOST_NOEXCEPT
26 {
27 long const res=*x;
28 return res;
29 }
30 inline void* interlocked_read_acquire(void* volatile* x) BOOST_NOEXCEPT
31 {
32 void* const res=*x;
33 return res;
34 }
35
36 // Since VS2005 volatile writes always release
37 inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT
38 {
39 *x=value;
40 }
41 inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT
42 {
43 *x=value;
44 }
45 }
46}
47
48#else
49
50namespace boost
51{
52 namespace detail
53 {
54 inline long interlocked_read_acquire(long volatile* x) BOOST_NOEXCEPT
55 {
56 return BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,0,0);
57 }
58 inline void* interlocked_read_acquire(void* volatile* x) BOOST_NOEXCEPT
59 {
60 return BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(x,0,0);
61 }
62 inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT
63 {
64 BOOST_INTERLOCKED_EXCHANGE(x,value);
65 }
66 inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT
67 {
68 BOOST_INTERLOCKED_EXCHANGE_POINTER(x,value);
69 }
70 }
71}
72
73#endif
74
75#include <boost/config/abi_suffix.hpp>
76
77#endif