]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/winapi/thread_pool.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / winapi / thread_pool.hpp
1 /*
2 * Copyright 2013 Andrey Semashev
3 *
4 * Distributed under the Boost Software License, Version 1.0.
5 * See http://www.boost.org/LICENSE_1_0.txt
6 */
7
8 #ifndef BOOST_WINAPI_THREAD_POOL_HPP_INCLUDED_
9 #define BOOST_WINAPI_THREAD_POOL_HPP_INCLUDED_
10
11 #include <boost/winapi/config.hpp>
12
13 #ifdef BOOST_HAS_PRAGMA_ONCE
14 #pragma once
15 #endif
16
17 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K
18
19 #include <boost/winapi/basic_types.hpp>
20
21 #if !defined( BOOST_USE_WINDOWS_H )
22 extern "C" {
23 #if BOOST_WINAPI_PARTITION_DESKTOP
24 typedef boost::winapi::VOID_ (NTAPI *WAITORTIMERCALLBACKFUNC)
25 (boost::winapi::PVOID_, boost::winapi::BOOLEAN_);
26 typedef WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK;
27
28 BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ WINAPI
29 RegisterWaitForSingleObject(
30 boost::winapi::PHANDLE_ phNewWaitObject,
31 boost::winapi::HANDLE_ hObject,
32 WAITORTIMERCALLBACK Callback,
33 boost::winapi::PVOID_ Context,
34 boost::winapi::ULONG_ dwMilliseconds,
35 boost::winapi::ULONG_ dwFlags);
36 #endif
37 } // extern "C"
38 #endif
39
40 // MinGW is buggy - it is missing these function declarations for Win2000
41 #if !defined( BOOST_USE_WINDOWS_H ) || (defined(BOOST_WINAPI_IS_MINGW) && BOOST_USE_WINAPI_VERSION < BOOST_WINAPI_VERSION_WINXP)
42 extern "C" {
43 #if BOOST_WINAPI_PARTITION_DESKTOP
44 BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ WINAPI
45 UnregisterWait(boost::winapi::HANDLE_ WaitHandle);
46 #endif
47
48 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
49 BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ WINAPI
50 UnregisterWaitEx(
51 boost::winapi::HANDLE_ WaitHandle,
52 boost::winapi::HANDLE_ CompletionEvent);
53 #endif
54 } // extern "C"
55 #endif
56
57 namespace boost {
58 namespace winapi {
59
60 #if BOOST_WINAPI_PARTITION_DESKTOP
61 typedef ::WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACKFUNC_;
62 typedef ::WAITORTIMERCALLBACK WAITORTIMERCALLBACK_;
63
64 using ::RegisterWaitForSingleObject;
65 using ::UnregisterWait;
66 #endif
67
68 #if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
69 using ::UnregisterWaitEx;
70 #endif
71 #if defined( BOOST_USE_WINDOWS_H )
72
73 const ULONG_ WT_EXECUTEDEFAULT_ = WT_EXECUTEDEFAULT;
74 const ULONG_ WT_EXECUTEINIOTHREAD_ = WT_EXECUTEINIOTHREAD;
75 #if defined( BOOST_WINAPI_IS_MINGW )
76 const ULONG_ WT_EXECUTEINUITHREAD_ = 0x00000002;
77 #else
78 const ULONG_ WT_EXECUTEINUITHREAD_ = WT_EXECUTEINUITHREAD;
79 #endif
80 const ULONG_ WT_EXECUTEINWAITTHREAD_ = WT_EXECUTEINWAITTHREAD;
81 const ULONG_ WT_EXECUTEONLYONCE_ = WT_EXECUTEONLYONCE;
82 const ULONG_ WT_EXECUTEINTIMERTHREAD_ = WT_EXECUTEINTIMERTHREAD;
83 const ULONG_ WT_EXECUTELONGFUNCTION_ = WT_EXECUTELONGFUNCTION;
84 #if defined( BOOST_WINAPI_IS_MINGW )
85 const ULONG_ WT_EXECUTEINPERSISTENTIOTHREAD_ = 0x00000040;
86 #else
87 const ULONG_ WT_EXECUTEINPERSISTENTIOTHREAD_ = WT_EXECUTEINPERSISTENTIOTHREAD;
88 #endif
89 const ULONG_ WT_EXECUTEINPERSISTENTTHREAD_ = WT_EXECUTEINPERSISTENTTHREAD;
90 const ULONG_ WT_TRANSFER_IMPERSONATION_ = WT_TRANSFER_IMPERSONATION;
91
92 #else // defined( BOOST_USE_WINDOWS_H )
93
94 const ULONG_ WT_EXECUTEDEFAULT_ = 0x00000000;
95 const ULONG_ WT_EXECUTEINIOTHREAD_ = 0x00000001;
96 const ULONG_ WT_EXECUTEINUITHREAD_ = 0x00000002;
97 const ULONG_ WT_EXECUTEINWAITTHREAD_ = 0x00000004;
98 const ULONG_ WT_EXECUTEONLYONCE_ = 0x00000008;
99 const ULONG_ WT_EXECUTEINTIMERTHREAD_ = 0x00000020;
100 const ULONG_ WT_EXECUTELONGFUNCTION_ = 0x00000010;
101 const ULONG_ WT_EXECUTEINPERSISTENTIOTHREAD_ = 0x00000040;
102 const ULONG_ WT_EXECUTEINPERSISTENTTHREAD_ = 0x00000080;
103 const ULONG_ WT_TRANSFER_IMPERSONATION_ = 0x00000100;
104
105 #endif // defined( BOOST_USE_WINDOWS_H )
106
107 BOOST_FORCEINLINE BOOST_CONSTEXPR ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit) BOOST_NOEXCEPT
108 {
109 // Note: We don't use WT_SET_MAX_THREADPOOL_THREADS here because the way it's defined
110 // the function no longer meets C++11 constexpr requirements.
111 return flags | (limit << 16);
112 }
113
114 const ULONG_ wt_execute_default = WT_EXECUTEDEFAULT_;
115 const ULONG_ wt_execute_in_io_thread = WT_EXECUTEINIOTHREAD_;
116 const ULONG_ wt_execute_in_ui_thread = WT_EXECUTEINUITHREAD_;
117 const ULONG_ wt_execute_in_wait_thread = WT_EXECUTEINWAITTHREAD_;
118 const ULONG_ wt_execute_only_once = WT_EXECUTEONLYONCE_;
119 const ULONG_ wt_execute_in_timer_thread = WT_EXECUTEINTIMERTHREAD_;
120 const ULONG_ wt_execute_long_function = WT_EXECUTELONGFUNCTION_;
121 const ULONG_ wt_execute_in_persistent_io_thread = WT_EXECUTEINPERSISTENTIOTHREAD_;
122 const ULONG_ wt_execute_in_persistent_thread = WT_EXECUTEINPERSISTENTTHREAD_;
123 const ULONG_ wt_transfer_impersonation = WT_TRANSFER_IMPERSONATION_;
124
125 }
126 }
127
128 #endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K
129 #endif // BOOST_WINAPI_THREAD_POOL_HPP_INCLUDED_