From 8bbdfbceed4944be83021ee5e6f91cb1659b94a3 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 25 Sep 2019 15:51:59 +0200 Subject: [PATCH] include: Add threadpoolapiset.h file. Based on patch by Hans Leidekker. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- include/Makefile.in | 1 + include/threadpoolapiset.h | 65 ++++++++++++++++++++++++++++++++++++++ include/winbase.h | 29 +---------------- include/winnt.h | 1 - 4 files changed, 67 insertions(+), 29 deletions(-) create mode 100644 include/threadpoolapiset.h diff --git a/include/Makefile.in b/include/Makefile.in index d0acefbb55e..7832d64a0ed 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -630,6 +630,7 @@ SOURCES = \ tcpmib.h \ textserv.h \ textstor.idl \ + threadpoolapiset.h \ thumbcache.idl \ timezoneapi.h \ tlhelp32.h \ diff --git a/include/threadpoolapiset.h b/include/threadpoolapiset.h new file mode 100644 index 00000000000..010ee3acf64 --- /dev/null +++ b/include/threadpoolapiset.h @@ -0,0 +1,65 @@ +/* + * Copyright 2019 Hans Leidekker for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _THREADPOOLAPISET_H_ +#define _THREADPOOLAPISET_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (CALLBACK *PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PVOID,ULONG,ULONG_PTR,PTP_IO); + +WINBASEAPI void WINAPI CancelThreadpoolIo(TP_IO*); +WINBASEAPI void WINAPI CloseThreadpool(PTP_POOL); +WINBASEAPI void WINAPI CloseThreadpoolCleanupGroup(PTP_CLEANUP_GROUP); +WINBASEAPI void WINAPI CloseThreadpoolCleanupGroupMembers(PTP_CLEANUP_GROUP,BOOL,PVOID); +WINBASEAPI void WINAPI CloseThreadpoolIo(TP_IO*); +WINBASEAPI void WINAPI CloseThreadpoolTimer(PTP_TIMER); +WINBASEAPI void WINAPI CloseThreadpoolWait(PTP_WAIT); +WINBASEAPI void WINAPI CloseThreadpoolWork(PTP_WORK); +WINBASEAPI PTP_POOL WINAPI CreateThreadpool(PVOID); +WINBASEAPI PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup(void); +WINBASEAPI PTP_IO WINAPI CreateThreadpoolIo(HANDLE,PTP_WIN32_IO_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON); +WINBASEAPI PTP_TIMER WINAPI CreateThreadpoolTimer(PTP_TIMER_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON); +WINBASEAPI PTP_WAIT WINAPI CreateThreadpoolWait(PTP_WAIT_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON); +WINBASEAPI PTP_WORK WINAPI CreateThreadpoolWork(PTP_WORK_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON); +WINBASEAPI void WINAPI DisassociateCurrentThreadFromCallback(PTP_CALLBACK_INSTANCE); +WINBASEAPI void WINAPI FreeLibraryWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HMODULE); +WINBASEAPI BOOL WINAPI IsThreadpoolTimerSet(PTP_TIMER); +WINBASEAPI void WINAPI LeaveCriticalSectionWhenCallbackReturns(PTP_CALLBACK_INSTANCE,RTL_CRITICAL_SECTION*); +WINBASEAPI void WINAPI ReleaseMutexWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE); +WINBASEAPI void WINAPI ReleaseSemaphoreWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE,DWORD); +WINBASEAPI void WINAPI SetEventWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE); +WINBASEAPI void WINAPI SetThreadpoolThreadMaximum(PTP_POOL,DWORD); +WINBASEAPI BOOL WINAPI SetThreadpoolThreadMinimum(PTP_POOL,DWORD); +WINBASEAPI void WINAPI SetThreadpoolTimer(PTP_TIMER,FILETIME*,DWORD,DWORD); +WINBASEAPI void WINAPI SetThreadpoolWait(PTP_WAIT,HANDLE,FILETIME *); +WINBASEAPI void WINAPI StartThreadpoolIo(TP_IO*); +WINBASEAPI void WINAPI SubmitThreadpoolWork(PTP_WORK); +WINBASEAPI BOOL WINAPI TrySubmitThreadpoolCallback(PTP_SIMPLE_CALLBACK,void*,TP_CALLBACK_ENVIRON*); +WINBASEAPI void WINAPI WaitForThreadpoolIoCallbacks(TP_IO*,BOOL); +WINBASEAPI void WINAPI WaitForThreadpoolTimerCallbacks(PTP_TIMER,BOOL); +WINBASEAPI void WINAPI WaitForThreadpoolWaitCallbacks(PTP_WAIT,BOOL); +WINBASEAPI void WINAPI WaitForThreadpoolWorkCallbacks(PTP_WORK,BOOL); + +#ifdef __cplusplus +} +#endif + +#endif /* _THREADPOOLAPISET_H_ */ diff --git a/include/winbase.h b/include/winbase.h index aa8b144230b..83a09d84731 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -39,6 +39,7 @@ extern "C" { #include #include +#include /* Windows Exit Procedure flag values */ #define WEP_FREE_DLL 0 @@ -1827,12 +1828,6 @@ WINADVAPI BOOL WINAPI ClearEventLogW(HANDLE,LPCWSTR); #define ClearEventLog WINELIB_NAME_AW(ClearEventLog) WINADVAPI BOOL WINAPI CloseEventLog(HANDLE); WINBASEAPI BOOL WINAPI CloseHandle(HANDLE); -WINBASEAPI VOID WINAPI CloseThreadpool(PTP_POOL); -WINBASEAPI VOID WINAPI CloseThreadpoolCleanupGroup(PTP_CLEANUP_GROUP); -WINBASEAPI VOID WINAPI CloseThreadpoolCleanupGroupMembers(PTP_CLEANUP_GROUP,BOOL,PVOID); -WINBASEAPI VOID WINAPI CloseThreadpoolTimer(PTP_TIMER); -WINBASEAPI VOID WINAPI CloseThreadpoolWait(PTP_WAIT); -WINBASEAPI VOID WINAPI CloseThreadpoolWork(PTP_WORK); WINBASEAPI BOOL WINAPI CommConfigDialogA(LPCSTR,HWND,LPCOMMCONFIG); WINBASEAPI BOOL WINAPI CommConfigDialogW(LPCWSTR,HWND,LPCOMMCONFIG); #define CommConfigDialog WINELIB_NAME_AW(CommConfigDialog) @@ -1896,12 +1891,6 @@ WINBASEAPI BOOL WINAPI CreatePipe(PHANDLE,PHANDLE,LPSECURITY_ATTRIBUTES,D WINADVAPI BOOL WINAPI CreatePrivateObjectSecurity(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,BOOL,HANDLE,PGENERIC_MAPPING); WINADVAPI BOOL WINAPI CreatePrivateObjectSecurityEx(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,GUID*,BOOL,ULONG,HANDLE,PGENERIC_MAPPING); WINADVAPI BOOL WINAPI CreatePrivateObjectSecurityWithMultipleInheritance(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,GUID**,ULONG,BOOL,ULONG,HANDLE,PGENERIC_MAPPING); -WINBASEAPI PTP_POOL WINAPI CreateThreadpool(PVOID); -WINBASEAPI PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup(void); -WINBASEAPI PTP_IO WINAPI CreateThreadpoolIo(HANDLE,PTP_WIN32_IO_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON); -WINBASEAPI PTP_TIMER WINAPI CreateThreadpoolTimer(PTP_TIMER_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON); -WINBASEAPI PTP_WAIT WINAPI CreateThreadpoolWait(PTP_WAIT_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON); -WINBASEAPI PTP_WORK WINAPI CreateThreadpoolWork(PTP_WORK_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON); WINBASEAPI BOOL WINAPI CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,LPVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION); WINBASEAPI BOOL WINAPI CreateProcessW(LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,LPVOID,LPCWSTR,LPSTARTUPINFOW,LPPROCESS_INFORMATION); #define CreateProcess WINELIB_NAME_AW(CreateProcess) @@ -1976,7 +1965,6 @@ WINADVAPI BOOL WINAPI DeregisterEventSource(HANDLE); WINADVAPI BOOL WINAPI DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR*); WINBASEAPI BOOL WINAPI DeviceIoControl(HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPOVERLAPPED); WINBASEAPI BOOL WINAPI DisableThreadLibraryCalls(HMODULE); -WINBASEAPI VOID WINAPI DisassociateCurrentThreadFromCallback(PTP_CALLBACK_INSTANCE); WINBASEAPI BOOL WINAPI DisconnectNamedPipe(HANDLE); WINBASEAPI BOOL WINAPI DnsHostnameToComputerNameA(LPCSTR,LPSTR,LPDWORD); WINBASEAPI BOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR,LPWSTR,LPDWORD); @@ -2094,7 +2082,6 @@ WINBASEAPI BOOL WINAPI FreeEnvironmentStringsW(LPWSTR); #define FreeEnvironmentStrings WINELIB_NAME_AW(FreeEnvironmentStrings) WINBASEAPI BOOL WINAPI FreeLibrary(HMODULE); WINBASEAPI VOID DECLSPEC_NORETURN WINAPI FreeLibraryAndExitThread(HINSTANCE,DWORD); -WINBASEAPI VOID WINAPI FreeLibraryWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HMODULE); #define FreeModule(handle) FreeLibrary(handle) #define FreeProcInstance(proc) /*nothing*/ WINBASEAPI BOOL WINAPI FreeResource(HGLOBAL); @@ -2419,7 +2406,6 @@ WINBASEAPI BOOL WINAPI IsBadWritePtr(LPVOID,UINT_PTR); WINBASEAPI BOOL WINAPI IsDebuggerPresent(void); WINBASEAPI BOOL WINAPI IsSystemResumeAutomatic(void); WINADVAPI BOOL WINAPI IsTextUnicode(LPCVOID,INT,LPINT); -WINBASEAPI BOOL WINAPI IsThreadpoolTimerSet(PTP_TIMER); WINADVAPI BOOL WINAPI IsTokenRestricted(HANDLE); WINADVAPI BOOL WINAPI IsValidAcl(PACL); WINADVAPI BOOL WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR); @@ -2432,7 +2418,6 @@ WINADVAPI BOOL WINAPI ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL); WINBASEAPI BOOL WINAPI IsProcessInJob(HANDLE,HANDLE,PBOOL); WINBASEAPI BOOL WINAPI IsProcessorFeaturePresent(DWORD); WINBASEAPI void WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit); -WINBASEAPI VOID WINAPI LeaveCriticalSectionWhenCallbackReturns(PTP_CALLBACK_INSTANCE,CRITICAL_SECTION*); WINBASEAPI HMODULE WINAPI LoadLibraryA(LPCSTR); WINBASEAPI HMODULE WINAPI LoadLibraryW(LPCWSTR); #define LoadLibrary WINELIB_NAME_AW(LoadLibrary) @@ -2595,9 +2580,7 @@ WINBASEAPI BOOL WINAPI RegisterWaitForSingleObject(PHANDLE,HANDLE,WAITORT WINBASEAPI HANDLE WINAPI RegisterWaitForSingleObjectEx(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG); WINBASEAPI VOID WINAPI ReleaseActCtx(HANDLE); WINBASEAPI BOOL WINAPI ReleaseMutex(HANDLE); -WINBASEAPI VOID WINAPI ReleaseMutexWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE); WINBASEAPI BOOL WINAPI ReleaseSemaphore(HANDLE,LONG,LPLONG); -WINBASEAPI VOID WINAPI ReleaseSemaphoreWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE,DWORD); WINBASEAPI VOID WINAPI ReleaseSRWLockExclusive(PSRWLOCK); WINBASEAPI VOID WINAPI ReleaseSRWLockShared(PSRWLOCK); WINBASEAPI ULONG WINAPI RemoveVectoredExceptionHandler(PVOID); @@ -2648,7 +2631,6 @@ WINBASEAPI BOOL WINAPI SetEnvironmentVariableW(LPCWSTR,LPCWSTR); #define SetEnvironmentVariable WINELIB_NAME_AW(SetEnvironmentVariable) WINBASEAPI UINT WINAPI SetErrorMode(UINT); WINBASEAPI BOOL WINAPI SetEvent(HANDLE); -WINBASEAPI VOID WINAPI SetEventWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE); WINBASEAPI VOID WINAPI SetFileApisToANSI(void); WINBASEAPI VOID WINAPI SetFileApisToOEM(void); WINBASEAPI BOOL WINAPI SetFileAttributesA(LPCSTR,DWORD); @@ -2696,13 +2678,9 @@ WINBASEAPI BOOL WINAPI SetThreadContext(HANDLE,const CONTEXT *); WINBASEAPI BOOL WINAPI SetThreadErrorMode(DWORD,LPDWORD); WINBASEAPI DWORD WINAPI SetThreadExecutionState(EXECUTION_STATE); WINBASEAPI DWORD WINAPI SetThreadIdealProcessor(HANDLE,DWORD); -WINBASEAPI VOID WINAPI SetThreadpoolThreadMaximum(PTP_POOL,DWORD); -WINBASEAPI BOOL WINAPI SetThreadpoolThreadMinimum(PTP_POOL,DWORD); WINBASEAPI BOOL WINAPI SetThreadPriority(HANDLE,INT); WINBASEAPI BOOL WINAPI SetThreadPriorityBoost(HANDLE,BOOL); WINADVAPI BOOL WINAPI SetThreadToken(PHANDLE,HANDLE); -WINBASEAPI VOID WINAPI SetThreadpoolTimer(PTP_TIMER,FILETIME*,DWORD,DWORD); -WINBASEAPI VOID WINAPI SetThreadpoolWait(PTP_WAIT,HANDLE,FILETIME *); WINBASEAPI HANDLE WINAPI SetTimerQueueTimer(HANDLE,WAITORTIMERCALLBACK,PVOID,DWORD,DWORD,BOOL); WINBASEAPI BOOL WINAPI SetTimeZoneInformation(const TIME_ZONE_INFORMATION *); WINADVAPI BOOL WINAPI SetTokenInformation(HANDLE,TOKEN_INFORMATION_CLASS,LPVOID,DWORD); @@ -2723,7 +2701,6 @@ WINBASEAPI VOID WINAPI Sleep(DWORD); WINBASEAPI BOOL WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE,PCRITICAL_SECTION,DWORD); WINBASEAPI BOOL WINAPI SleepConditionVariableSRW(PCONDITION_VARIABLE,PSRWLOCK,DWORD,ULONG); WINBASEAPI DWORD WINAPI SleepEx(DWORD,BOOL); -WINBASEAPI VOID WINAPI SubmitThreadpoolWork(PTP_WORK); WINBASEAPI DWORD WINAPI SuspendThread(HANDLE); WINBASEAPI void WINAPI SwitchToFiber(LPVOID); WINBASEAPI BOOL WINAPI SwitchToThread(void); @@ -2741,7 +2718,6 @@ WINBASEAPI BOOL WINAPI TransmitCommChar(HANDLE,CHAR); WINBASEAPI BOOLEAN WINAPI TryAcquireSRWLockExclusive(PSRWLOCK); WINBASEAPI BOOLEAN WINAPI TryAcquireSRWLockShared(PSRWLOCK); WINBASEAPI BOOL WINAPI TryEnterCriticalSection(CRITICAL_SECTION *lpCrit); -WINBASEAPI BOOL WINAPI TrySubmitThreadpoolCallback(PTP_SIMPLE_CALLBACK,void*,TP_CALLBACK_ENVIRON*); WINBASEAPI BOOL WINAPI TzSpecificLocalTimeToSystemTime(const TIME_ZONE_INFORMATION*,const SYSTEMTIME*,LPSYSTEMTIME); WINBASEAPI LONG WINAPI UnhandledExceptionFilter(PEXCEPTION_POINTERS); WINBASEAPI BOOL WINAPI UnlockFile(HANDLE,DWORD,DWORD,DWORD,DWORD); @@ -2778,9 +2754,6 @@ WINBASEAPI DWORD WINAPI WaitForMultipleObjects(DWORD,const HANDLE*,BOOL,DW WINBASEAPI DWORD WINAPI WaitForMultipleObjectsEx(DWORD,const HANDLE*,BOOL,DWORD,BOOL); WINBASEAPI DWORD WINAPI WaitForSingleObject(HANDLE,DWORD); WINBASEAPI DWORD WINAPI WaitForSingleObjectEx(HANDLE,DWORD,BOOL); -WINBASEAPI VOID WINAPI WaitForThreadpoolTimerCallbacks(PTP_TIMER,BOOL); -WINBASEAPI VOID WINAPI WaitForThreadpoolWaitCallbacks(PTP_WAIT,BOOL); -WINBASEAPI VOID WINAPI WaitForThreadpoolWorkCallbacks(PTP_WORK,BOOL); WINBASEAPI BOOL WINAPI WaitNamedPipeA(LPCSTR,DWORD); WINBASEAPI BOOL WINAPI WaitNamedPipeW(LPCWSTR,DWORD); #define WaitNamedPipe WINELIB_NAME_AW(WaitNamedPipe) diff --git a/include/winnt.h b/include/winnt.h index 9c4174f310d..5e9057199e0 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -6606,7 +6606,6 @@ typedef TP_CALLBACK_ENVIRON_V1 TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON; typedef VOID (CALLBACK *PTP_WORK_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_WORK); typedef VOID (CALLBACK *PTP_TIMER_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_TIMER); typedef VOID (CALLBACK *PTP_WAIT_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_WAIT,TP_WAIT_RESULT); -typedef VOID (CALLBACK *PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PVOID,ULONG,ULONG_PTR,PTP_IO); NTSYSAPI BOOLEAN NTAPI RtlGetProductInfo(DWORD,DWORD,DWORD,DWORD,PDWORD);