]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/winapi/init_once.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / winapi / init_once.hpp
1 /*
2 * Copyright 2010 Vicente J. Botet Escriba
3 * Copyright 2015 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_INIT_ONCE_HPP_INCLUDED_
10 #define BOOST_WINAPI_INIT_ONCE_HPP_INCLUDED_
11
12 #include <boost/winapi/config.hpp>
13
14 #ifdef BOOST_HAS_PRAGMA_ONCE
15 #pragma once
16 #endif
17
18 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
19
20 #include <boost/winapi/basic_types.hpp>
21
22 #if !defined( BOOST_USE_WINDOWS_H )
23 extern "C" {
24 #if defined( BOOST_WINAPI_IS_MINGW_W64 )
25 struct _RTL_RUN_ONCE;
26 #else
27 union _RTL_RUN_ONCE;
28 #endif
29
30 typedef boost::winapi::BOOL_
31 (WINAPI *PINIT_ONCE_FN) (
32 ::_RTL_RUN_ONCE* InitOnce,
33 boost::winapi::PVOID_ Parameter,
34 boost::winapi::PVOID_ *Context);
35
36 BOOST_SYMBOL_IMPORT boost::winapi::VOID_ WINAPI
37 InitOnceInitialize(::_RTL_RUN_ONCE* InitOnce);
38
39 BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ WINAPI
40 InitOnceExecuteOnce(
41 ::_RTL_RUN_ONCE* InitOnce,
42 ::PINIT_ONCE_FN InitFn,
43 boost::winapi::PVOID_ Parameter,
44 boost::winapi::LPVOID_ *Context);
45
46 BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ WINAPI
47 InitOnceBeginInitialize(
48 ::_RTL_RUN_ONCE* lpInitOnce,
49 boost::winapi::DWORD_ dwFlags,
50 boost::winapi::PBOOL_ fPending,
51 boost::winapi::LPVOID_ *lpContext);
52
53 BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ WINAPI
54 InitOnceComplete(
55 ::_RTL_RUN_ONCE* lpInitOnce,
56 boost::winapi::DWORD_ dwFlags,
57 boost::winapi::LPVOID_ lpContext);
58 }
59 #endif
60
61 namespace boost {
62 namespace winapi {
63
64 typedef union BOOST_MAY_ALIAS _RTL_RUN_ONCE {
65 PVOID_ Ptr;
66 } INIT_ONCE_, *PINIT_ONCE_, *LPINIT_ONCE_;
67
68 extern "C" {
69 typedef BOOL_ (WINAPI *PINIT_ONCE_FN_) (PINIT_ONCE_ lpInitOnce, PVOID_ Parameter, PVOID_ *Context);
70 }
71
72 BOOST_FORCEINLINE VOID_ InitOnceInitialize(PINIT_ONCE_ lpInitOnce)
73 {
74 ::InitOnceInitialize(reinterpret_cast< ::_RTL_RUN_ONCE* >(lpInitOnce));
75 }
76
77 BOOST_FORCEINLINE BOOL_ InitOnceExecuteOnce(PINIT_ONCE_ lpInitOnce, PINIT_ONCE_FN_ InitFn, PVOID_ Parameter, LPVOID_ *Context)
78 {
79 return ::InitOnceExecuteOnce(reinterpret_cast< ::_RTL_RUN_ONCE* >(lpInitOnce), reinterpret_cast< ::PINIT_ONCE_FN >(InitFn), Parameter, Context);
80 }
81
82 BOOST_FORCEINLINE BOOL_ InitOnceBeginInitialize(PINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, PBOOL_ fPending, LPVOID_ *lpContext)
83 {
84 return ::InitOnceBeginInitialize(reinterpret_cast< ::_RTL_RUN_ONCE* >(lpInitOnce), dwFlags, fPending, lpContext);
85 }
86
87 BOOST_FORCEINLINE BOOL_ InitOnceComplete(PINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, LPVOID_ lpContext)
88 {
89 return ::InitOnceComplete(reinterpret_cast< ::_RTL_RUN_ONCE* >(lpInitOnce), dwFlags, lpContext);
90 }
91
92 #if defined( BOOST_USE_WINDOWS_H )
93
94 #define BOOST_WINAPI_INIT_ONCE_STATIC_INIT INIT_ONCE_STATIC_INIT
95 const DWORD_ INIT_ONCE_ASYNC_ = INIT_ONCE_ASYNC;
96 const DWORD_ INIT_ONCE_CHECK_ONLY_ = INIT_ONCE_CHECK_ONLY;
97 const DWORD_ INIT_ONCE_INIT_FAILED_ = INIT_ONCE_INIT_FAILED;
98 const DWORD_ INIT_ONCE_CTX_RESERVED_BITS_ = INIT_ONCE_CTX_RESERVED_BITS;
99
100 #else // defined( BOOST_USE_WINDOWS_H )
101
102 #define BOOST_WINAPI_INIT_ONCE_STATIC_INIT {0}
103 const DWORD_ INIT_ONCE_ASYNC_ = 0x00000002UL;
104 const DWORD_ INIT_ONCE_CHECK_ONLY_ = 0x00000001UL;
105 const DWORD_ INIT_ONCE_INIT_FAILED_ = 0x00000004UL;
106 const DWORD_ INIT_ONCE_CTX_RESERVED_BITS_ = 2;
107
108 #endif // defined( BOOST_USE_WINDOWS_H )
109
110 const DWORD_ init_once_async = INIT_ONCE_ASYNC_;
111 const DWORD_ init_once_check_only = INIT_ONCE_CHECK_ONLY_;
112 const DWORD_ init_once_init_failed = INIT_ONCE_INIT_FAILED_;
113 const DWORD_ init_once_ctx_reserved_bits = INIT_ONCE_CTX_RESERVED_BITS_;
114
115 }
116 }
117
118 #endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
119
120 #endif // BOOST_WINAPI_INIT_ONCE_HPP_INCLUDED_