]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/winapi/include/boost/detail/winapi/waitable_timer.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / winapi / include / boost / detail / winapi / waitable_timer.hpp
CommitLineData
7c673cae
FG
1// waitable_timer.hpp --------------------------------------------------------------//
2
3// Copyright 2013 Andrey Semashev
4
5// Distributed under the Boost Software License, Version 1.0.
6// See http://www.boost.org/LICENSE_1_0.txt
7
8
9#ifndef BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP
10#define BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP
11
12#include <boost/detail/winapi/basic_types.hpp>
13
14#ifdef BOOST_HAS_PRAGMA_ONCE
15#pragma once
16#endif
17
18#if !defined( BOOST_USE_WINDOWS_H )
19extern "C" {
20typedef boost::detail::winapi::VOID_
21(WINAPI *PTIMERAPCROUTINE)(
22 boost::detail::winapi::LPVOID_ lpArgToCompletionRoutine,
23 boost::detail::winapi::DWORD_ dwTimerLowValue,
24 boost::detail::winapi::DWORD_ dwTimerHighValue);
25
26#if !defined( BOOST_NO_ANSI_APIS )
27BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
28CreateWaitableTimerA(
29 ::_SECURITY_ATTRIBUTES* lpTimerAttributes,
30 boost::detail::winapi::BOOL_ bManualReset,
31 boost::detail::winapi::LPCSTR_ lpTimerName);
32
33BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
34OpenWaitableTimerA(
35 boost::detail::winapi::DWORD_ dwDesiredAccess,
36 boost::detail::winapi::BOOL_ bInheritHandle,
37 boost::detail::winapi::LPCSTR_ lpTimerName);
38#endif
39
40BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
41CreateWaitableTimerW(
42 ::_SECURITY_ATTRIBUTES* lpTimerAttributes,
43 boost::detail::winapi::BOOL_ bManualReset,
44 boost::detail::winapi::LPCWSTR_ lpTimerName);
45
46BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
47OpenWaitableTimerW(
48 boost::detail::winapi::DWORD_ dwDesiredAccess,
49 boost::detail::winapi::BOOL_ bInheritHandle,
50 boost::detail::winapi::LPCWSTR_ lpTimerName);
51
52BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
53SetWaitableTimer(
54 boost::detail::winapi::HANDLE_ hTimer,
55 const ::_LARGE_INTEGER* lpDueTime,
56 boost::detail::winapi::LONG_ lPeriod,
57 PTIMERAPCROUTINE pfnCompletionRoutine,
58 boost::detail::winapi::LPVOID_ lpArgToCompletionRoutine,
59 boost::detail::winapi::BOOL_ fResume);
60
61BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
62CancelWaitableTimer(boost::detail::winapi::HANDLE_ hTimer);
63}
64#endif
65
66namespace boost {
67namespace detail {
68namespace winapi {
69
70typedef ::PTIMERAPCROUTINE PTIMERAPCROUTINE_;
71
72#if !defined( BOOST_NO_ANSI_APIS )
73using ::OpenWaitableTimerA;
74#endif
75using ::OpenWaitableTimerW;
76using ::CancelWaitableTimer;
77
78#if defined( BOOST_USE_WINDOWS_H )
79
80const DWORD_ TIMER_ALL_ACCESS_ = TIMER_ALL_ACCESS;
81const DWORD_ TIMER_MODIFY_STATE_ = TIMER_MODIFY_STATE;
82const DWORD_ TIMER_QUERY_STATE_ = TIMER_QUERY_STATE;
83
84#else // defined( BOOST_USE_WINDOWS_H )
85
86const DWORD_ TIMER_ALL_ACCESS_ = 0x001F0003;
87const DWORD_ TIMER_MODIFY_STATE_ = 0x00000002;
88const DWORD_ TIMER_QUERY_STATE_ = 0x00000001;
89
90#endif // defined( BOOST_USE_WINDOWS_H )
91
92const DWORD_ timer_all_access = TIMER_ALL_ACCESS_;
93const DWORD_ timer_modify_state = TIMER_MODIFY_STATE_;
94const DWORD_ timer_query_state = TIMER_QUERY_STATE_;
95
96
97#if !defined( BOOST_NO_ANSI_APIS )
98BOOST_FORCEINLINE HANDLE_ CreateWaitableTimerA(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset, LPCSTR_ lpTimerName)
99{
100 return ::CreateWaitableTimerA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, lpTimerName);
101}
102#endif
103
104BOOST_FORCEINLINE HANDLE_ CreateWaitableTimerW(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset, LPCWSTR_ lpTimerName)
105{
106 return ::CreateWaitableTimerW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, lpTimerName);
107}
108
109BOOST_FORCEINLINE BOOL_ SetWaitableTimer(
110 HANDLE_ hTimer,
111 const LARGE_INTEGER_* lpDueTime,
112 LONG_ lPeriod,
113 PTIMERAPCROUTINE_ pfnCompletionRoutine,
114 LPVOID_ lpArgToCompletionRoutine,
115 BOOL_ fResume)
116{
117 return ::SetWaitableTimer(hTimer, reinterpret_cast< const ::_LARGE_INTEGER* >(lpDueTime), lPeriod, pfnCompletionRoutine, lpArgToCompletionRoutine, fResume);
118}
119
120#if !defined( BOOST_NO_ANSI_APIS )
121BOOST_FORCEINLINE HANDLE_ create_waitable_timer(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset, LPCSTR_ lpTimerName)
122{
123 return ::CreateWaitableTimerA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, lpTimerName);
124}
125#endif
126
127BOOST_FORCEINLINE HANDLE_ create_waitable_timer(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset, LPCWSTR_ lpTimerName)
128{
129 return ::CreateWaitableTimerW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, lpTimerName);
130}
131
132BOOST_FORCEINLINE HANDLE_ create_anonymous_waitable_timer(PSECURITY_ATTRIBUTES_ lpTimerAttributes, BOOL_ bManualReset)
133{
134#ifdef BOOST_NO_ANSI_APIS
135 return ::CreateWaitableTimerW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, 0);
136#else
137 return ::CreateWaitableTimerA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpTimerAttributes), bManualReset, 0);
138#endif
139}
140
141}
142}
143}
144
145#endif // BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP