]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/winapi/include/boost/detail/winapi/event.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / winapi / include / boost / detail / winapi / event.hpp
CommitLineData
7c673cae
FG
1// event.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_EVENT_HPP
11#define BOOST_DETAIL_WINAPI_EVENT_HPP
12
13#include <boost/detail/winapi/basic_types.hpp>
14#include <boost/predef/platform.h>
15
16#ifdef BOOST_HAS_PRAGMA_ONCE
17#pragma once
18#endif
19
20#if !defined( BOOST_USE_WINDOWS_H )
21extern "C" {
22#if !defined( BOOST_NO_ANSI_APIS )
23#if !defined( BOOST_PLAT_WINDOWS_RUNTIME_AVALIABLE )
24BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
25CreateEventA(
26 ::_SECURITY_ATTRIBUTES* lpEventAttributes,
27 boost::detail::winapi::BOOL_ bManualReset,
28 boost::detail::winapi::BOOL_ bInitialState,
29 boost::detail::winapi::LPCSTR_ lpName);
30#endif
31
32#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
33BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
34CreateEventExA(
35 ::_SECURITY_ATTRIBUTES *lpEventAttributes,
36 boost::detail::winapi::LPCSTR_ lpName,
37 boost::detail::winapi::DWORD_ dwFlags,
38 boost::detail::winapi::DWORD_ dwDesiredAccess);
39#endif
40
41BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
42OpenEventA(
43 boost::detail::winapi::DWORD_ dwDesiredAccess,
44 boost::detail::winapi::BOOL_ bInheritHandle,
45 boost::detail::winapi::LPCSTR_ lpName);
46#endif
47
48BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
49CreateEventW(
50 ::_SECURITY_ATTRIBUTES* lpEventAttributes,
51 boost::detail::winapi::BOOL_ bManualReset,
52 boost::detail::winapi::BOOL_ bInitialState,
53 boost::detail::winapi::LPCWSTR_ lpName);
54
55#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
56BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
57CreateEventExW(
58 ::_SECURITY_ATTRIBUTES *lpEventAttributes,
59 boost::detail::winapi::LPCWSTR_ lpName,
60 boost::detail::winapi::DWORD_ dwFlags,
61 boost::detail::winapi::DWORD_ dwDesiredAccess);
62#endif
63
64BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI
65OpenEventW(
66 boost::detail::winapi::DWORD_ dwDesiredAccess,
67 boost::detail::winapi::BOOL_ bInheritHandle,
68 boost::detail::winapi::LPCWSTR_ lpName);
69
70// Windows CE define SetEvent/ResetEvent as inline functions in kfuncs.h
71#if !defined( UNDER_CE )
72BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
73SetEvent(boost::detail::winapi::HANDLE_ hEvent);
74
75BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
76ResetEvent(boost::detail::winapi::HANDLE_ hEvent);
77#endif
78}
79#endif
80
81namespace boost {
82namespace detail {
83namespace winapi {
84
85#if !defined( BOOST_NO_ANSI_APIS )
86using ::OpenEventA;
87#endif
88using ::OpenEventW;
89using ::SetEvent;
90using ::ResetEvent;
91
92#if defined( BOOST_USE_WINDOWS_H )
93
94const DWORD_ EVENT_ALL_ACCESS_ = EVENT_ALL_ACCESS;
95const DWORD_ EVENT_MODIFY_STATE_ = EVENT_MODIFY_STATE;
96#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
97const DWORD_ CREATE_EVENT_INITIAL_SET_ = CREATE_EVENT_INITIAL_SET;
98const DWORD_ CREATE_EVENT_MANUAL_RESET_ = CREATE_EVENT_MANUAL_RESET;
99#endif
100
101#else // defined( BOOST_USE_WINDOWS_H )
102
103const DWORD_ EVENT_ALL_ACCESS_ = 0x001F0003;
104const DWORD_ EVENT_MODIFY_STATE_ = 0x00000002;
105#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
106const DWORD_ CREATE_EVENT_INITIAL_SET_ = 0x00000002;
107const DWORD_ CREATE_EVENT_MANUAL_RESET_ = 0x00000001;
108#endif
109
110#endif // defined( BOOST_USE_WINDOWS_H )
111
112// Undocumented and not present in Windows SDK. Enables NtQueryEvent.
113// http://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FNT%20Objects%2FEvent%2FNtQueryEvent.html
114const DWORD_ EVENT_QUERY_STATE_ = 0x00000001;
115
116const DWORD_ event_all_access = EVENT_ALL_ACCESS_;
117const DWORD_ event_modify_state = EVENT_MODIFY_STATE_;
118#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
119const DWORD_ create_event_initial_set = CREATE_EVENT_INITIAL_SET_;
120const DWORD_ create_event_manual_reset = CREATE_EVENT_MANUAL_RESET_;
121#endif
122
123#if !defined( BOOST_NO_ANSI_APIS )
124BOOST_FORCEINLINE HANDLE_ CreateEventA(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState, LPCSTR_ lpName)
125{
126#if BOOST_PLAT_WINDOWS_RUNTIME && BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
127 const DWORD_ flags = (bManualReset ? create_event_manual_reset : 0u) | (bInitialState ? create_event_initial_set : 0u);
128 return ::CreateEventExA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), lpName, flags, event_all_access);
129#else
130 return ::CreateEventA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), bManualReset, bInitialState, lpName);
131#endif
132}
133
134#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
135BOOST_FORCEINLINE HANDLE_ CreateEventExA(SECURITY_ATTRIBUTES_* lpEventAttributes, LPCSTR_ lpName, DWORD_ dwFlags, DWORD_ dwDesiredAccess)
136{
137 return ::CreateEventExA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), lpName, dwFlags, dwDesiredAccess);
138}
139#endif
140#endif
141
142BOOST_FORCEINLINE HANDLE_ CreateEventW(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState, LPCWSTR_ lpName)
143{
144#if BOOST_PLAT_WINDOWS_RUNTIME && BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
145 const DWORD_ flags = (bManualReset ? create_event_manual_reset : 0u) | (bInitialState ? create_event_initial_set : 0u);
146 return ::CreateEventExW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), lpName, flags, event_all_access);
147#else
148 return ::CreateEventW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), bManualReset, bInitialState, lpName);
149#endif
150}
151
152#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
153BOOST_FORCEINLINE HANDLE_ CreateEventExW(SECURITY_ATTRIBUTES_* lpEventAttributes, LPCWSTR_ lpName, DWORD_ dwFlags, DWORD_ dwDesiredAccess)
154{
155 return ::CreateEventExW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpEventAttributes), lpName, dwFlags, dwDesiredAccess);
156}
157#endif
158
159#if !defined( BOOST_NO_ANSI_APIS )
160BOOST_FORCEINLINE HANDLE_ create_event(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState, LPCSTR_ lpName)
161{
162 return winapi::CreateEventA(lpEventAttributes, bManualReset, bInitialState, lpName);
163}
164
165BOOST_FORCEINLINE HANDLE_ open_event(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName)
166{
167 return ::OpenEventA(dwDesiredAccess, bInheritHandle, lpName);
168}
169#endif
170
171BOOST_FORCEINLINE HANDLE_ create_event(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState, LPCWSTR_ lpName)
172{
173 return winapi::CreateEventW(lpEventAttributes, bManualReset, bInitialState, lpName);
174}
175
176BOOST_FORCEINLINE HANDLE_ open_event(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName)
177{
178 return ::OpenEventW(dwDesiredAccess, bInheritHandle, lpName);
179}
180
181BOOST_FORCEINLINE HANDLE_ create_anonymous_event(SECURITY_ATTRIBUTES_* lpEventAttributes, BOOL_ bManualReset, BOOL_ bInitialState)
182{
183 return winapi::CreateEventW(lpEventAttributes, bManualReset, bInitialState, 0);
184}
185
186}
187}
188}
189
190#endif // BOOST_DETAIL_WINAPI_EVENT_HPP