]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/winapi/include/boost/detail/winapi/srw_lock.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / winapi / include / boost / detail / winapi / srw_lock.hpp
CommitLineData
7c673cae
FG
1// srw_lock.hpp --------------------------------------------------------------//
2
3// Copyright 2010 Vicente J. Botet Escriba
4// Copyright 2015 Andrey Semashev
5
6// Distributed under the Boost Software License, Version 1.0.
7// See http://www.boost.org/LICENSE_1_0.txt
8
9
10#ifndef BOOST_DETAIL_WINAPI_SRW_LOCK_HPP
11#define BOOST_DETAIL_WINAPI_SRW_LOCK_HPP
12
13#include <boost/detail/winapi/config.hpp>
14
15#ifdef BOOST_HAS_PRAGMA_ONCE
16#pragma once
17#endif
18
19#if BOOST_USE_WINAPI_VERSION < BOOST_WINAPI_VERSION_WIN6 \
20 || (defined(_MSC_VER) && _MSC_VER < 1600)
21// Windows SDK 6.0A, which is used by MSVC 9, does not have TryAcquireSRWLock* neither in headers nor in .lib files,
22// although the functions are present in later SDKs since Windows API version 6.
23#define BOOST_WINAPI_NO_TRY_ACQUIRE_SRWLOCK
24#endif
25
26#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
27
28#include <boost/detail/winapi/basic_types.hpp>
29
30#if !defined( BOOST_USE_WINDOWS_H )
31extern "C" {
32struct _RTL_SRWLOCK;
33
34BOOST_SYMBOL_IMPORT boost::detail::winapi::VOID_ WINAPI
35InitializeSRWLock(::_RTL_SRWLOCK* SRWLock);
36
37BOOST_SYMBOL_IMPORT boost::detail::winapi::VOID_ WINAPI
38ReleaseSRWLockExclusive(::_RTL_SRWLOCK* SRWLock);
39
40BOOST_SYMBOL_IMPORT boost::detail::winapi::VOID_ WINAPI
41ReleaseSRWLockShared(::_RTL_SRWLOCK* SRWLock);
42
43BOOST_SYMBOL_IMPORT boost::detail::winapi::VOID_ WINAPI
44AcquireSRWLockExclusive(::_RTL_SRWLOCK* SRWLock);
45
46BOOST_SYMBOL_IMPORT boost::detail::winapi::VOID_ WINAPI
47AcquireSRWLockShared(::_RTL_SRWLOCK* SRWLock);
48
49#if !defined( BOOST_WINAPI_NO_TRY_ACQUIRE_SRWLOCK )
50BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOLEAN_ WINAPI
51TryAcquireSRWLockExclusive(::_RTL_SRWLOCK* SRWLock);
52
53BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOLEAN_ WINAPI
54TryAcquireSRWLockShared(::_RTL_SRWLOCK* SRWLock);
55#endif
56}
57#endif
58
59namespace boost {
60namespace detail {
61namespace winapi {
62
63typedef struct BOOST_DETAIL_WINAPI_MAY_ALIAS _RTL_SRWLOCK {
64 PVOID_ Ptr;
65} SRWLOCK_, *PSRWLOCK_;
66
67#if defined( BOOST_USE_WINDOWS_H )
68#define BOOST_DETAIL_WINAPI_SRWLOCK_INIT SRWLOCK_INIT
69#else
70#define BOOST_DETAIL_WINAPI_SRWLOCK_INIT {0}
71#endif
72
73BOOST_FORCEINLINE VOID_ InitializeSRWLock(PSRWLOCK_ SRWLock)
74{
75 ::InitializeSRWLock(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
76}
77
78BOOST_FORCEINLINE VOID_ ReleaseSRWLockExclusive(PSRWLOCK_ SRWLock)
79{
80 ::ReleaseSRWLockExclusive(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
81}
82
83BOOST_FORCEINLINE VOID_ ReleaseSRWLockShared(PSRWLOCK_ SRWLock)
84{
85 ::ReleaseSRWLockShared(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
86}
87
88BOOST_FORCEINLINE VOID_ AcquireSRWLockExclusive(PSRWLOCK_ SRWLock)
89{
90 ::AcquireSRWLockExclusive(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
91}
92
93BOOST_FORCEINLINE VOID_ AcquireSRWLockShared(PSRWLOCK_ SRWLock)
94{
95 ::AcquireSRWLockShared(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
96}
97
98#if !defined( BOOST_WINAPI_NO_TRY_ACQUIRE_SRWLOCK )
99BOOST_FORCEINLINE BOOLEAN_ TryAcquireSRWLockExclusive(PSRWLOCK_ SRWLock)
100{
101 return ::TryAcquireSRWLockExclusive(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
102}
103
104BOOST_FORCEINLINE BOOLEAN_ TryAcquireSRWLockShared(PSRWLOCK_ SRWLock)
105{
106 return ::TryAcquireSRWLockShared(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
107}
108#endif
109
110}
111}
112}
113
114#endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
115
116#endif // BOOST_DETAIL_WINAPI_SRW_LOCK_HPP