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