File indexing completed on 2025-01-18 09:53:44
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_WINAPI_CONDITION_VARIABLE_HPP_INCLUDED_
0010 #define BOOST_WINAPI_CONDITION_VARIABLE_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
0020 #include <boost/winapi/basic_types.hpp>
0021 #include <boost/winapi/detail/header.hpp>
0022
0023 #if !defined( BOOST_USE_WINDOWS_H )
0024 extern "C" {
0025 struct _RTL_CONDITION_VARIABLE;
0026 struct _RTL_CRITICAL_SECTION;
0027 struct _RTL_SRWLOCK;
0028
0029 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
0030 InitializeConditionVariable(::_RTL_CONDITION_VARIABLE* ConditionVariable);
0031
0032 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
0033 WakeConditionVariable(::_RTL_CONDITION_VARIABLE* ConditionVariable);
0034
0035 BOOST_WINAPI_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
0036 WakeAllConditionVariable(::_RTL_CONDITION_VARIABLE* ConditionVariable);
0037
0038 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0039 SleepConditionVariableCS(
0040 ::_RTL_CONDITION_VARIABLE* ConditionVariable,
0041 ::_RTL_CRITICAL_SECTION* CriticalSection,
0042 boost::winapi::DWORD_ dwMilliseconds);
0043
0044 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0045 SleepConditionVariableSRW(
0046 ::_RTL_CONDITION_VARIABLE* ConditionVariable,
0047 ::_RTL_SRWLOCK* SRWLock,
0048 boost::winapi::DWORD_ dwMilliseconds,
0049 boost::winapi::ULONG_ Flags);
0050 }
0051 #endif
0052
0053 namespace boost {
0054 namespace winapi {
0055
0056 typedef struct BOOST_MAY_ALIAS _RTL_CONDITION_VARIABLE {
0057 PVOID_ Ptr;
0058 } CONDITION_VARIABLE_, *PCONDITION_VARIABLE_;
0059
0060 #if defined( BOOST_USE_WINDOWS_H )
0061 #define BOOST_WINAPI_CONDITION_VARIABLE_INIT CONDITION_VARIABLE_INIT
0062 #else
0063 #define BOOST_WINAPI_CONDITION_VARIABLE_INIT {0}
0064 #endif
0065
0066 struct _RTL_CRITICAL_SECTION;
0067 struct _RTL_SRWLOCK;
0068
0069 BOOST_FORCEINLINE VOID_ InitializeConditionVariable(PCONDITION_VARIABLE_ ConditionVariable)
0070 {
0071 ::InitializeConditionVariable(reinterpret_cast< ::_RTL_CONDITION_VARIABLE* >(ConditionVariable));
0072 }
0073
0074 BOOST_FORCEINLINE VOID_ WakeConditionVariable(PCONDITION_VARIABLE_ ConditionVariable)
0075 {
0076 ::WakeConditionVariable(reinterpret_cast< ::_RTL_CONDITION_VARIABLE* >(ConditionVariable));
0077 }
0078
0079 BOOST_FORCEINLINE VOID_ WakeAllConditionVariable(PCONDITION_VARIABLE_ ConditionVariable)
0080 {
0081 ::WakeAllConditionVariable(reinterpret_cast< ::_RTL_CONDITION_VARIABLE* >(ConditionVariable));
0082 }
0083
0084 BOOST_FORCEINLINE BOOL_ SleepConditionVariableCS(
0085 PCONDITION_VARIABLE_ ConditionVariable,
0086 _RTL_CRITICAL_SECTION* CriticalSection,
0087 DWORD_ dwMilliseconds)
0088 {
0089 return ::SleepConditionVariableCS(
0090 reinterpret_cast< ::_RTL_CONDITION_VARIABLE* >(ConditionVariable),
0091 reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(CriticalSection),
0092 dwMilliseconds);
0093 }
0094
0095 BOOST_FORCEINLINE BOOL_ SleepConditionVariableSRW(
0096 PCONDITION_VARIABLE_ ConditionVariable,
0097 _RTL_SRWLOCK* SRWLock,
0098 DWORD_ dwMilliseconds,
0099 ULONG_ Flags)
0100 {
0101 return ::SleepConditionVariableSRW(
0102 reinterpret_cast< ::_RTL_CONDITION_VARIABLE* >(ConditionVariable),
0103 reinterpret_cast< ::_RTL_SRWLOCK* >(SRWLock),
0104 dwMilliseconds,
0105 Flags);
0106 }
0107
0108 #if defined( BOOST_USE_WINDOWS_H )
0109 BOOST_CONSTEXPR_OR_CONST ULONG_ CONDITION_VARIABLE_LOCKMODE_SHARED_ = CONDITION_VARIABLE_LOCKMODE_SHARED;
0110 #else
0111 BOOST_CONSTEXPR_OR_CONST ULONG_ CONDITION_VARIABLE_LOCKMODE_SHARED_ = 0x00000001;
0112 #endif
0113
0114 BOOST_CONSTEXPR_OR_CONST ULONG_ condition_variable_lockmode_shared = CONDITION_VARIABLE_LOCKMODE_SHARED_;
0115
0116 }
0117 }
0118
0119 #include <boost/winapi/detail/footer.hpp>
0120
0121 #endif
0122
0123 #endif