From c6724c8ae7877402401ea16b46b8aca6eccf5f37 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbap...@gmail.com>
Date: Wed, 19 May 2021 23:02:30 +0530
Subject: [PATCH] headers: Add thread pool wrappers in winbase.h.

Required for FreeRDP project.

Signed-off-by: Biswapriyo Nath <nathbap...@gmail.com>
---
 mingw-w64-headers/include/winbase.h | 41 ++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/mingw-w64-headers/include/winbase.h 
b/mingw-w64-headers/include/winbase.h
index dff8ee5..08f8977 100644
--- a/mingw-w64-headers/include/winbase.h
+++ b/mingw-w64-headers/include/winbase.h
@@ -3292,11 +3292,50 @@ extern "C" {
 #endif
 #endif
 
-#ifdef __cplusplus
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+#if _WIN32_WINNT >= 0x0600
+#if !defined(__WIDL__)
+
+FORCEINLINE VOID InitializeThreadpoolEnvironment(PTP_CALLBACK_ENVIRON cbe) {
+  TpInitializeCallbackEnviron(cbe);
+}
+
+FORCEINLINE VOID SetThreadpoolCallbackPool(PTP_CALLBACK_ENVIRON cbe, PTP_POOL 
pool) {
+  TpSetCallbackThreadpool(cbe, pool);
+}
+
+FORCEINLINE VOID SetThreadpoolCallbackCleanupGroup(PTP_CALLBACK_ENVIRON cbe, 
PTP_CLEANUP_GROUP cleanup_group, PTP_CLEANUP_GROUP_CANCEL_CALLBACK 
cleanup_group_cb) {
+  TpSetCallbackCleanupGroup(cbe, cleanup_group, cleanup_group_cb);
+}
+
+FORCEINLINE VOID SetThreadpoolCallbackRunsLong(PTP_CALLBACK_ENVIRON cbe) {
+  TpSetCallbackLongFunction(cbe);
+}
+
+FORCEINLINE VOID SetThreadpoolCallbackLibrary(PTP_CALLBACK_ENVIRON cbe, PVOID 
h) {
+  TpSetCallbackRaceWithDll(cbe, h);
+}
+
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN7
+FORCEINLINE VOID SetThreadpoolCallbackPriority(PTP_CALLBACK_ENVIRON cbe, 
TP_CALLBACK_PRIORITY prio) {
+  TpSetCallbackPriority(cbe, prio);
 }
 #endif
+
+FORCEINLINE VOID DestroyThreadpoolEnvironment(PTP_CALLBACK_ENVIRON cbe) {
+  TpDestroyCallbackEnviron(cbe);
+}
+
+#endif /* !__WIDL__ */
+#endif /* _WIN32_WINNT >= 0x0600 */
+#endif /* WINAPI_PARTITION_APP */
+
+#ifdef __cplusplus
+}
 #endif
 
+#endif /* _WINBASE_ */
+
 #if !defined (RC_INVOKED) && !defined (NOWINBASEINTERLOCK) && !defined 
(_NTOS_) && !defined 
(MICROSOFT_WINDOWS_WINBASE_INTERLOCKED_CPLUSPLUS_H_INCLUDED)
 #define MICROSOFT_WINDOWS_WINBASE_INTERLOCKED_CPLUSPLUS_H_INCLUDED
 #if !defined (__WIDL__)
-- 
2.31.1

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to