File indexing completed on 2025-01-30 10:02:28
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_WINAPI_SRW_LOCK_HPP_INCLUDED_
0010 #define BOOST_WINAPI_SRW_LOCK_HPP_INCLUDED_
0011
0012 #include <boost/winapi/config.hpp>
0013
0014 #ifdef BOOST_HAS_PRAGMA_ONCE
0015 #pragma once
0016 #endif
0017
0018 #if BOOST_USE_WINAPI_VERSION < BOOST_WINAPI_VERSION_WIN6 \
0019 || (defined(_MSC_VER) && _MSC_VER < 1600)
0020
0021
0022 #define BOOST_WINAPI_NO_TRY_ACQUIRE_SRWLOCK
0023 #endif
0024
0025 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
0026
0027 #include <boost/winapi/basic_types.hpp>
0028 #include <boost/winapi/detail/header.hpp>
0029
0030 #if !defined( BOOST_USE_WINDOWS_H )
0031 extern "C" {
0032 struct _RTL_SRWLOCK;
0033
0034 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
0035 InitializeSRWLock(::_RTL_SRWLOCK* SRWLock);
0036
0037 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
0038 ReleaseSRWLockExclusive(::_RTL_SRWLOCK* SRWLock);
0039
0040 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
0041 ReleaseSRWLockShared(::_RTL_SRWLOCK* SRWLock);
0042
0043 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
0044 AcquireSRWLockExclusive(::_RTL_SRWLOCK* SRWLock);
0045
0046 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
0047 AcquireSRWLockShared(::_RTL_SRWLOCK* SRWLock);
0048
0049 #if !defined( BOOST_WINAPI_NO_TRY_ACQUIRE_SRWLOCK )
0050 BOOST_WINAPI_IMPORT boost::winapi::BOOLEAN_ BOOST_WINAPI_WINAPI_CC
0051 TryAcquireSRWLockExclusive(::_RTL_SRWLOCK* SRWLock);
0052
0053 BOOST_WINAPI_IMPORT boost::winapi::BOOLEAN_ BOOST_WINAPI_WINAPI_CC
0054 TryAcquireSRWLockShared(::_RTL_SRWLOCK* SRWLock);
0055 #endif
0056 }
0057 #endif
0058
0059 namespace boost {
0060 namespace winapi {
0061
0062 typedef struct BOOST_MAY_ALIAS _RTL_SRWLOCK {
0063 PVOID_ Ptr;
0064 } SRWLOCK_, *PSRWLOCK_;
0065
0066 #if defined( BOOST_USE_WINDOWS_H )
0067 #define BOOST_WINAPI_SRWLOCK_INIT SRWLOCK_INIT
0068 #else
0069 #define BOOST_WINAPI_SRWLOCK_INIT {0}
0070 #endif
0071
0072 BOOST_FORCEINLINE VOID_ InitializeSRWLock(PSRWLOCK_ SRWLock)
0073 {
0074 ::InitializeSRWLock(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
0075 }
0076
0077 BOOST_FORCEINLINE VOID_ ReleaseSRWLockExclusive(PSRWLOCK_ SRWLock)
0078 {
0079 ::ReleaseSRWLockExclusive(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
0080 }
0081
0082 BOOST_FORCEINLINE VOID_ ReleaseSRWLockShared(PSRWLOCK_ SRWLock)
0083 {
0084 ::ReleaseSRWLockShared(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
0085 }
0086
0087 BOOST_FORCEINLINE VOID_ AcquireSRWLockExclusive(PSRWLOCK_ SRWLock)
0088 {
0089 ::AcquireSRWLockExclusive(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
0090 }
0091
0092 BOOST_FORCEINLINE VOID_ AcquireSRWLockShared(PSRWLOCK_ SRWLock)
0093 {
0094 ::AcquireSRWLockShared(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
0095 }
0096
0097 #if !defined( BOOST_WINAPI_NO_TRY_ACQUIRE_SRWLOCK )
0098 BOOST_FORCEINLINE BOOLEAN_ TryAcquireSRWLockExclusive(PSRWLOCK_ SRWLock)
0099 {
0100 return ::TryAcquireSRWLockExclusive(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
0101 }
0102
0103 BOOST_FORCEINLINE BOOLEAN_ TryAcquireSRWLockShared(PSRWLOCK_ SRWLock)
0104 {
0105 return ::TryAcquireSRWLockShared(reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock));
0106 }
0107 #endif
0108
0109 }
0110 }
0111
0112 #include <boost/winapi/detail/footer.hpp>
0113
0114 #endif
0115
0116 #endif