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