| 1 |
// Licensed under the Apache License, Version 2.0 |
| 2 |
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 3 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. |
| 4 |
// All files in the project carrying such notice may not be copied, modified, or distributed |
| 5 |
// except according to those terms. |
| 6 |
//! ApiSet Contract for api-ms-win-core-threadpool-l1. |
| 7 |
use shared::basetsd::ULONG_PTR; |
| 8 |
use shared::minwindef::{BOOL, DWORD, HMODULE, PFILETIME, ULONG}; |
| 9 |
use um::minwinbase::PCRITICAL_SECTION; |
| 10 |
use um::winnt::{ |
| 11 |
HANDLE, PTP_CALLBACK_ENVIRON, PTP_CALLBACK_INSTANCE, PTP_CLEANUP_GROUP, PTP_IO, PTP_POOL, |
| 12 |
PTP_POOL_STACK_INFORMATION, PTP_SIMPLE_CALLBACK, PTP_TIMER, PTP_TIMER_CALLBACK, PTP_WAIT, |
| 13 |
PTP_WAIT_CALLBACK, PTP_WORK, PTP_WORK_CALLBACK, PVOID, |
| 14 |
}; |
| 15 |
FN!{stdcall PTP_WIN32_IO_CALLBACK( |
| 16 |
Instance: PTP_CALLBACK_INSTANCE, |
| 17 |
Context: PVOID, |
| 18 |
Overlapped: PVOID, |
| 19 |
IoResult: ULONG, |
| 20 |
NumberOfBytesTransferred: ULONG_PTR, |
| 21 |
Io: PTP_IO, |
| 22 |
) -> ()} |
| 23 |
extern "system" { |
| 24 |
pub fn CreateThreadpool( |
| 25 |
reserved: PVOID, |
| 26 |
) -> PTP_POOL; |
| 27 |
pub fn SetThreadpoolThreadMaximum( |
| 28 |
ptpp: PTP_POOL, |
| 29 |
cthrdMost: DWORD, |
| 30 |
) -> (); |
| 31 |
pub fn SetThreadpoolThreadMinimum( |
| 32 |
ptpp: PTP_POOL, |
| 33 |
cthrdMic: DWORD, |
| 34 |
) -> BOOL; |
| 35 |
pub fn SetThreadpoolStackInformation( |
| 36 |
ptpp: PTP_POOL, |
| 37 |
ptpsi: PTP_POOL_STACK_INFORMATION, |
| 38 |
) -> BOOL; |
| 39 |
pub fn QueryThreadpoolStackInformation( |
| 40 |
ptpp: PTP_POOL, |
| 41 |
ptpsi: PTP_POOL_STACK_INFORMATION, |
| 42 |
) -> BOOL; |
| 43 |
pub fn CloseThreadpool( |
| 44 |
ptpp: PTP_POOL, |
| 45 |
) -> (); |
| 46 |
pub fn CreateThreadpoolCleanupGroup() -> PTP_CLEANUP_GROUP; |
| 47 |
pub fn CloseThreadpoolCleanupGroupMembers( |
| 48 |
ptpcg: PTP_CLEANUP_GROUP, |
| 49 |
fCancelPendingCallbacks: BOOL, |
| 50 |
pvCleanupContext: PVOID, |
| 51 |
) -> (); |
| 52 |
pub fn CloseThreadpoolCleanupGroup( |
| 53 |
ptpcg: PTP_CLEANUP_GROUP, |
| 54 |
) -> (); |
| 55 |
pub fn SetEventWhenCallbackReturns( |
| 56 |
pci: PTP_CALLBACK_INSTANCE, |
| 57 |
evt: HANDLE, |
| 58 |
) -> (); |
| 59 |
pub fn ReleaseSemaphoreWhenCallbackReturns( |
| 60 |
pci: PTP_CALLBACK_INSTANCE, |
| 61 |
sem: HANDLE, |
| 62 |
crel: DWORD, |
| 63 |
) -> (); |
| 64 |
pub fn ReleaseMutexWhenCallbackReturns( |
| 65 |
pci: PTP_CALLBACK_INSTANCE, |
| 66 |
mut_: HANDLE, |
| 67 |
) -> (); |
| 68 |
pub fn LeaveCriticalSectionWhenCallbackReturns( |
| 69 |
pci: PTP_CALLBACK_INSTANCE, |
| 70 |
pcs: PCRITICAL_SECTION, |
| 71 |
) -> (); |
| 72 |
pub fn FreeLibraryWhenCallbackReturns( |
| 73 |
pci: PTP_CALLBACK_INSTANCE, |
| 74 |
mod_: HMODULE, |
| 75 |
) -> (); |
| 76 |
pub fn CallbackMayRunLong( |
| 77 |
pci: PTP_CALLBACK_INSTANCE, |
| 78 |
) -> BOOL; |
| 79 |
pub fn DisassociateCurrentThreadFromCallback( |
| 80 |
pci: PTP_CALLBACK_INSTANCE, |
| 81 |
) -> (); |
| 82 |
pub fn TrySubmitThreadpoolCallback( |
| 83 |
pfns: PTP_SIMPLE_CALLBACK, |
| 84 |
pv: PVOID, |
| 85 |
pcbe: PTP_CALLBACK_ENVIRON, |
| 86 |
) -> BOOL; |
| 87 |
pub fn CreateThreadpoolWork( |
| 88 |
pfnwk: PTP_WORK_CALLBACK, |
| 89 |
pv: PVOID, |
| 90 |
pcbe: PTP_CALLBACK_ENVIRON, |
| 91 |
) -> PTP_WORK; |
| 92 |
pub fn SubmitThreadpoolWork( |
| 93 |
pwk: PTP_WORK, |
| 94 |
) -> (); |
| 95 |
pub fn WaitForThreadpoolWorkCallbacks( |
| 96 |
pwk: PTP_WORK, |
| 97 |
fCancelPendingCallbacks: BOOL, |
| 98 |
) -> (); |
| 99 |
pub fn CloseThreadpoolWork( |
| 100 |
pwk: PTP_WORK, |
| 101 |
) -> (); |
| 102 |
pub fn CreateThreadpoolTimer( |
| 103 |
pfnti: PTP_TIMER_CALLBACK, |
| 104 |
pv: PVOID, |
| 105 |
pcbe: PTP_CALLBACK_ENVIRON, |
| 106 |
) -> PTP_TIMER; |
| 107 |
pub fn SetThreadpoolTimer( |
| 108 |
pti: PTP_TIMER, |
| 109 |
pftDueTime: PFILETIME, |
| 110 |
msPeriod: DWORD, |
| 111 |
msWindowLength: DWORD, |
| 112 |
) -> (); |
| 113 |
pub fn IsThreadpoolTimerSet( |
| 114 |
pti: PTP_TIMER, |
| 115 |
) -> BOOL; |
| 116 |
pub fn WaitForThreadpoolTimerCallbacks( |
| 117 |
pti: PTP_TIMER, |
| 118 |
fCancelPendingCallbacks: BOOL, |
| 119 |
) -> (); |
| 120 |
pub fn CloseThreadpoolTimer( |
| 121 |
pti: PTP_TIMER, |
| 122 |
) -> (); |
| 123 |
pub fn CreateThreadpoolWait( |
| 124 |
pfnwa: PTP_WAIT_CALLBACK, |
| 125 |
pv: PVOID, |
| 126 |
pcbe: PTP_CALLBACK_ENVIRON, |
| 127 |
) -> PTP_WAIT; |
| 128 |
pub fn SetThreadpoolWait( |
| 129 |
pwa: PTP_WAIT, |
| 130 |
h: HANDLE, |
| 131 |
pftTimeout: PFILETIME, |
| 132 |
) -> (); |
| 133 |
pub fn WaitForThreadpoolWaitCallbacks( |
| 134 |
pwa: PTP_WAIT, |
| 135 |
fCancelPendingCallbacks: BOOL, |
| 136 |
) -> (); |
| 137 |
pub fn CloseThreadpoolWait( |
| 138 |
pwa: PTP_WAIT, |
| 139 |
) -> (); |
| 140 |
pub fn CreateThreadpoolIo( |
| 141 |
fl: HANDLE, |
| 142 |
pfnio: PTP_WIN32_IO_CALLBACK, |
| 143 |
pv: PVOID, |
| 144 |
pcbe: PTP_CALLBACK_ENVIRON, |
| 145 |
) -> PTP_IO; |
| 146 |
pub fn StartThreadpoolIo( |
| 147 |
pio: PTP_IO, |
| 148 |
) -> (); |
| 149 |
pub fn CancelThreadpoolIo( |
| 150 |
pio: PTP_IO, |
| 151 |
) -> (); |
| 152 |
pub fn WaitForThreadpoolIoCallbacks( |
| 153 |
pio: PTP_IO, |
| 154 |
fCancelPendingCallbacks: BOOL, |
| 155 |
) -> (); |
| 156 |
pub fn CloseThreadpoolIo( |
| 157 |
pio: PTP_IO, |
| 158 |
) -> (); |
| 159 |
pub fn SetThreadpoolTimerEx( |
| 160 |
pti: PTP_TIMER, |
| 161 |
pftDueTime: PFILETIME, |
| 162 |
msPeriod: DWORD, |
| 163 |
msWindowLength: DWORD, |
| 164 |
) -> BOOL; |
| 165 |
pub fn SetThreadpoolWaitEx( |
| 166 |
pwa: PTP_WAIT, |
| 167 |
h: HANDLE, |
| 168 |
pftTimeout: PFILETIME, |
| 169 |
Reserved: PVOID, |
| 170 |
) -> BOOL; |
| 171 |
} |