comparison DEPENDENCIES/generic/include/boost/detail/winapi/thread_pool.hpp @ 102:f46d142149f5

Whoops, finish that update
author Chris Cannam
date Mon, 07 Sep 2015 11:13:41 +0100
parents
children
comparison
equal deleted inserted replaced
101:c530137014c0 102:f46d142149f5
1 // thread_pool.hpp --------------------------------------------------------------//
2
3 // Copyright 2013 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_DETAIL_WINAPI_THREAD_POOL_HPP
10 #define BOOST_DETAIL_WINAPI_THREAD_POOL_HPP
11
12 #include <boost/detail/winapi/basic_types.hpp>
13
14 #ifdef BOOST_HAS_PRAGMA_ONCE
15 #pragma once
16 #endif
17
18 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K
19
20 namespace boost
21 {
22 namespace detail
23 {
24 namespace winapi
25 {
26 #if defined( BOOST_USE_WINDOWS_H )
27
28 typedef ::WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACKFUNC_;
29 typedef ::WAITORTIMERCALLBACK WAITORTIMERCALLBACK_;
30
31 using ::RegisterWaitForSingleObject;
32 using ::UnregisterWait;
33 using ::UnregisterWaitEx;
34
35 const ULONG_ wt_execute_default = WT_EXECUTEDEFAULT;
36 const ULONG_ wt_execute_in_io_thread = WT_EXECUTEINIOTHREAD;
37 const ULONG_ wt_execute_in_ui_thread = WT_EXECUTEINUITHREAD;
38 const ULONG_ wt_execute_in_wait_thread = WT_EXECUTEINWAITTHREAD;
39 const ULONG_ wt_execute_only_once = WT_EXECUTEONLYONCE;
40 const ULONG_ wt_execute_in_timer_thread = WT_EXECUTEINTIMERTHREAD;
41 const ULONG_ wt_execute_long_function = WT_EXECUTELONGFUNCTION;
42 const ULONG_ wt_execute_in_persistent_io_thread = WT_EXECUTEINPERSISTENTIOTHREAD;
43 const ULONG_ wt_execute_in_persistent_thread = WT_EXECUTEINPERSISTENTTHREAD;
44 const ULONG_ wt_transfer_impersonation = WT_TRANSFER_IMPERSONATION;
45
46 inline ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit)
47 {
48 return WT_SET_MAX_THREADPOOL_THREADS(flags, limit);
49 }
50
51 #else
52
53 extern "C" {
54
55 typedef void (NTAPI* WAITORTIMERCALLBACKFUNC_) (PVOID_, BOOLEAN_);
56 typedef WAITORTIMERCALLBACKFUNC_ WAITORTIMERCALLBACK_;
57
58 __declspec(dllimport) BOOL_ WINAPI RegisterWaitForSingleObject
59 (
60 HANDLE_* phNewWaitObject,
61 HANDLE_ hObject,
62 WAITORTIMERCALLBACK_ Callback,
63 PVOID_ Context,
64 ULONG_ dwMilliseconds,
65 ULONG_ dwFlags
66 );
67
68 __declspec(dllimport) BOOL_ WINAPI UnregisterWait(HANDLE_ WaitHandle);
69 __declspec(dllimport) BOOL_ WINAPI UnregisterWaitEx(HANDLE_ WaitHandle, HANDLE_ CompletionEvent);
70
71 } // extern "C"
72
73 const ULONG_ wt_execute_default = 0x00000000;
74 const ULONG_ wt_execute_in_io_thread = 0x00000001;
75 const ULONG_ wt_execute_in_ui_thread = 0x00000002;
76 const ULONG_ wt_execute_in_wait_thread = 0x00000004;
77 const ULONG_ wt_execute_only_once = 0x00000008;
78 const ULONG_ wt_execute_in_timer_thread = 0x00000020;
79 const ULONG_ wt_execute_long_function = 0x00000010;
80 const ULONG_ wt_execute_in_persistent_io_thread = 0x00000040;
81 const ULONG_ wt_execute_in_persistent_thread = 0x00000080;
82 const ULONG_ wt_transfer_impersonation = 0x00000100;
83
84 inline ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit)
85 {
86 return flags | (limit << 16);
87 }
88
89 #endif
90 }
91 }
92 }
93
94 #endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K
95
96 #endif // BOOST_DETAIL_WINAPI_THREAD_POOL_HPP