Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:28

0001 /*
0002  * Copyright 2013 Andrey Semashev
0003  *
0004  * Distributed under the Boost Software License, Version 1.0.
0005  * See http://www.boost.org/LICENSE_1_0.txt
0006  */
0007 
0008 #ifndef BOOST_WINAPI_WAITABLE_TIMER_HPP_INCLUDED_
0009 #define BOOST_WINAPI_WAITABLE_TIMER_HPP_INCLUDED_
0010 
0011 #include <boost/winapi/basic_types.hpp>
0012 
0013 #ifdef BOOST_HAS_PRAGMA_ONCE
0014 #pragma once
0015 #endif
0016 
0017 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
0018 
0019 #include <boost/winapi/detail/header.hpp>
0020 
0021 #if !defined( BOOST_USE_WINDOWS_H )
0022 extern "C" {
0023 typedef boost::winapi::VOID_
0024 (BOOST_WINAPI_WINAPI_CC *PTIMERAPCROUTINE)(
0025     boost::winapi::LPVOID_ lpArgToCompletionRoutine,
0026     boost::winapi::DWORD_ dwTimerLowValue,
0027     boost::winapi::DWORD_ dwTimerHighValue);
0028 
0029 #if !defined( BOOST_NO_ANSI_APIS )
0030 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0031 CreateWaitableTimerA(
0032     ::_SECURITY_ATTRIBUTES* lpTimerAttributes,
0033     boost::winapi::BOOL_ bManualReset,
0034     boost::winapi::LPCSTR_ lpTimerName);
0035 
0036 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0037 OpenWaitableTimerA(
0038     boost::winapi::DWORD_ dwDesiredAccess,
0039     boost::winapi::BOOL_ bInheritHandle,
0040     boost::winapi::LPCSTR_ lpTimerName);
0041 #endif
0042 
0043 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0044 CreateWaitableTimerW(
0045     ::_SECURITY_ATTRIBUTES* lpTimerAttributes,
0046     boost::winapi::BOOL_ bManualReset,
0047     boost::winapi::LPCWSTR_ lpTimerName);
0048 
0049 BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC
0050 OpenWaitableTimerW(
0051     boost::winapi::DWORD_ dwDesiredAccess,
0052     boost::winapi::BOOL_ bInheritHandle,
0053     boost::winapi::LPCWSTR_ lpTimerName);
0054 
0055 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0056 SetWaitableTimer(
0057     boost::winapi::HANDLE_ hTimer,
0058     const ::_LARGE_INTEGER* lpDueTime,
0059     boost::winapi::LONG_ lPeriod,
0060     PTIMERAPCROUTINE pfnCompletionRoutine,
0061     boost::winapi::LPVOID_ lpArgToCompletionRoutine,
0062     boost::winapi::BOOL_ fResume);
0063 
0064 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0065 CancelWaitableTimer(boost::winapi::HANDLE_ hTimer);
0066 } // extern "C"
0067 #endif
0068 
0069 namespace boost {
0070 namespace winapi {
0071 
0072 typedef ::PTIMERAPCROUTINE PTIMERAPCROUTINE_;
0073 
0074 #if !defined( BOOST_NO_ANSI_APIS )
0075 using ::OpenWaitableTimerA;
0076 #endif
0077 using ::OpenWaitableTimerW;
0078 using ::CancelWaitableTimer;
0079 
0080 #if defined( BOOST_USE_WINDOWS_H )
0081 
0082 BOOST_CONSTEXPR_OR_CONST DWORD_ TIMER_ALL_ACCESS_ = TIMER_ALL_ACCESS;
0083 BOOST_CONSTEXPR_OR_CONST DWORD_ TIMER_MODIFY_STATE_ = TIMER_MODIFY_STATE;
0084 BOOST_CONSTEXPR_OR_CONST DWORD_ TIMER_QUERY_STATE_ = TIMER_QUERY_STATE;
0085 
0086 #else // defined( BOOST_USE_WINDOWS_H )
0087 
0088 BOOST_CONSTEXPR_OR_CONST DWORD_ TIMER_ALL_ACCESS_ = 0x001F0003;
0089 BOOST_CONSTEXPR_OR_CONST DWORD_ TIMER_MODIFY_STATE_ = 0x00000002;
0090 BOOST_CONSTEXPR_OR_CONST DWORD_ TIMER_QUERY_STATE_ = 0x00000001;
0091 
0092 #endif // defined( BOOST_USE_WINDOWS_H )
0093 
0094 BOOST_CONSTEXPR_OR_CONST DWORD_ timer_all_access = TIMER_ALL_ACCESS_;
0095 BOOST_CONSTEXPR_OR_CONST DWORD_ timer_modify_state = TIMER_MODIFY_STATE_;
0096 BOOST_CONSTEXPR_OR_CONST DWORD_ timer_query_state = TIMER_QUERY_STATE_;
0097 
0098 
0099 #if !defined( BOOST_NO_ANSI_APIS )
0100 BOOST_FORCEINLINE HANDLE_ CreateWaitableTimerA(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset, LPCSTR_ lpTimerName)
0101 {
0102     return ::CreateWaitableTimerA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, lpTimerName);
0103 }
0104 #endif
0105 
0106 BOOST_FORCEINLINE HANDLE_ CreateWaitableTimerW(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset, LPCWSTR_ lpTimerName)
0107 {
0108     return ::CreateWaitableTimerW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, lpTimerName);
0109 }
0110 
0111 BOOST_FORCEINLINE BOOL_ SetWaitableTimer(
0112     HANDLE_ hTimer,
0113     const LARGE_INTEGER_* lpDueTime,
0114     LONG_ lPeriod,
0115     PTIMERAPCROUTINE_ pfnCompletionRoutine,
0116     LPVOID_ lpArgToCompletionRoutine,
0117     BOOL_ fResume)
0118 {
0119     return ::SetWaitableTimer(hTimer, reinterpret_cast< const ::_LARGE_INTEGER* >(lpDueTime), lPeriod, pfnCompletionRoutine, lpArgToCompletionRoutine, fResume);
0120 }
0121 
0122 #if !defined( BOOST_NO_ANSI_APIS )
0123 BOOST_FORCEINLINE HANDLE_ create_waitable_timer(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset, LPCSTR_ lpTimerName)
0124 {
0125     return ::CreateWaitableTimerA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, lpTimerName);
0126 }
0127 #endif
0128 
0129 BOOST_FORCEINLINE HANDLE_ create_waitable_timer(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset, LPCWSTR_ lpTimerName)
0130 {
0131     return ::CreateWaitableTimerW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, lpTimerName);
0132 }
0133 
0134 BOOST_FORCEINLINE HANDLE_ create_anonymous_waitable_timer(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset)
0135 {
0136 #ifdef BOOST_NO_ANSI_APIS
0137     return ::CreateWaitableTimerW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, 0);
0138 #else
0139     return ::CreateWaitableTimerA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, 0);
0140 #endif
0141 }
0142 
0143 }
0144 }
0145 
0146 #include <boost/winapi/detail/footer.hpp>
0147 
0148 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
0149 #endif // BOOST_WINAPI_WAITABLE_TIMER_HPP_INCLUDED_