Sebastian Lackner : kernel32: Forward remaining threadpool functions to ntdll.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jul 3 09:02:36 CDT 2015
Module: wine
Branch: master
Commit: eadd27a38a218e6ab27404d2981f3fe521f13361
URL: http://source.winehq.org/git/wine.git/?a=commit;h=eadd27a38a218e6ab27404d2981f3fe521f13361
Author: Sebastian Lackner <sebastian at fds-team.de>
Date: Fri Jul 3 02:00:31 2015 +0200
kernel32: Forward remaining threadpool functions to ntdll.
---
dlls/kernel32/kernel32.spec | 10 +++++-----
dlls/kernel32/tests/thread.c | 6 +++---
dlls/kernel32/thread.c | 40 ++++++++++++++++++++++++++++++++++++++++
include/winternl.h | 5 +++++
4 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index 0825bdb..a14d03b 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -228,7 +228,7 @@
# @ stub ClosePrivateNamespace
@ stdcall CloseProfileUserMapping()
@ stub CloseSystemHandle
-# @ stub CloseThreadpool
+@ stdcall CloseThreadpool(ptr) ntdll.TpReleasePool
@ stdcall CloseThreadpoolCleanupGroup(ptr) ntdll.TpReleaseCleanupGroup
@ stdcall CloseThreadpoolCleanupGroupMembers(ptr long ptr) ntdll.TpReleaseCleanupGroupMembers
# @ stub CloseThreadpoolIo
@@ -331,7 +331,7 @@
@ stdcall CreateSymbolicLinkW(wstr wstr long)
@ stdcall CreateTapePartition(long long long long)
@ stdcall CreateThread(ptr long ptr long long ptr)
-# @ stub CreateThreadpool
+@ stdcall CreateThreadpool(ptr)
@ stdcall CreateThreadpoolCleanupGroup()
# @ stub CreateThreadpoolIo
@ stdcall CreateThreadpoolTimer(ptr ptr ptr)
@@ -1454,8 +1454,8 @@
# @ stub SetThreadToken
@ stdcall SetThreadUILanguage(long)
# @ stub SetThreadpoolStackInformation
-# @ stub SetThreadpoolThreadMaximum
-# @ stub SetThreadpoolThreadMinimum
+@ stdcall SetThreadpoolThreadMaximum(ptr long) ntdll.TpSetPoolMaxThreads
+@ stdcall SetThreadpoolThreadMinimum(ptr long) ntdll.TpSetPoolMinThreads
@ stdcall SetThreadpoolTimer(ptr ptr long long)
# @ stub SetThreadpoolWait
@ stdcall SetTimeZoneInformation(ptr)
@@ -1509,7 +1509,7 @@
@ stdcall TryAcquireSRWLockExclusive(ptr) ntdll.RtlTryAcquireSRWLockExclusive
@ stdcall TryAcquireSRWLockShared(ptr) ntdll.RtlTryAcquireSRWLockShared
@ stdcall TryEnterCriticalSection(ptr) ntdll.RtlTryEnterCriticalSection
-# @ stub TrySubmitThreadpoolCallback
+@ stdcall TrySubmitThreadpoolCallback(ptr ptr ptr)
@ stdcall TzSpecificLocalTimeToSystemTime(ptr ptr ptr)
# @ stub TzSpecificLocalTimeToSystemTimeEx
# @ stub -arch=x86_64 uaw_lstrcmpW
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index d3ecd2a..25801b2 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -1627,8 +1627,8 @@ static void test_threadpool(void)
int workcalled = 0;
if (!pCreateThreadpool) {
- todo_wine win_skip("thread pool apis not supported.\n");
- return;
+ win_skip("thread pool apis not supported.\n");
+ return;
}
work = pCreateThreadpoolWork(threadpool_workcallback, &workcalled, NULL);
@@ -1640,7 +1640,7 @@ static void test_threadpool(void)
ok (workcalled == 1, "expected work to be called once, got %d\n", workcalled);
pool = pCreateThreadpool(NULL);
- todo_wine ok (pool != NULL, "CreateThreadpool failed\n");
+ ok (pool != NULL, "CreateThreadpool failed\n");
}
static void test_reserved_tls(void)
diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c
index c8e906d..21ec276 100644
--- a/dlls/kernel32/thread.c
+++ b/dlls/kernel32/thread.c
@@ -881,6 +881,26 @@ BOOL WINAPI CallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
}
/***********************************************************************
+ * CreateThreadpool (KERNEL32.@)
+ */
+PTP_POOL WINAPI CreateThreadpool( PVOID reserved )
+{
+ TP_POOL *pool;
+ NTSTATUS status;
+
+ TRACE( "%p\n", reserved );
+
+ status = TpAllocPool( &pool, reserved );
+ if (status)
+ {
+ SetLastError( RtlNtStatusToDosError(status) );
+ return NULL;
+ }
+
+ return pool;
+}
+
+/***********************************************************************
* CreateThreadpoolCleanupGroup (KERNEL32.@)
*/
PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup( void )
@@ -960,3 +980,23 @@ VOID WINAPI SetThreadpoolTimer( TP_TIMER *timer, FILETIME *due_time,
TpSetTimer( timer, due_time ? &timeout : NULL, period, window_length );
}
+
+/***********************************************************************
+ * TrySubmitThreadpoolCallback (KERNEL32.@)
+ */
+BOOL WINAPI TrySubmitThreadpoolCallback( PTP_SIMPLE_CALLBACK callback, PVOID userdata,
+ TP_CALLBACK_ENVIRON *environment )
+{
+ NTSTATUS status;
+
+ TRACE( "%p, %p, %p\n", callback, userdata, environment );
+
+ status = TpSimpleTryPost( callback, userdata, environment );
+ if (status)
+ {
+ SetLastError( RtlNtStatusToDosError(status) );
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/include/winternl.h b/include/winternl.h
index 5b07994..e1707fd 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2619,6 +2619,7 @@ NTSYSAPI NTSTATUS WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PC
/* Threadpool functions */
NTSYSAPI NTSTATUS WINAPI TpAllocCleanupGroup(TP_CLEANUP_GROUP **);
+NTSYSAPI NTSTATUS WINAPI TpAllocPool(TP_POOL **,PVOID);
NTSYSAPI NTSTATUS WINAPI TpAllocTimer(TP_TIMER **,PTP_TIMER_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *);
NTSYSAPI NTSTATUS WINAPI TpAllocWork(TP_WORK **,PTP_WORK_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *);
NTSYSAPI void WINAPI TpCallbackLeaveCriticalSectionOnCompletion(TP_CALLBACK_INSTANCE *,RTL_CRITICAL_SECTION *);
@@ -2632,9 +2633,13 @@ NTSYSAPI BOOL WINAPI TpIsTimerSet(TP_TIMER *);
NTSYSAPI void WINAPI TpPostWork(TP_WORK *);
NTSYSAPI void WINAPI TpReleaseCleanupGroup(TP_CLEANUP_GROUP *);
NTSYSAPI void WINAPI TpReleaseCleanupGroupMembers(TP_CLEANUP_GROUP *,BOOL,PVOID);
+NTSYSAPI void WINAPI TpReleasePool(TP_POOL *);
NTSYSAPI void WINAPI TpReleaseTimer(TP_TIMER *);
NTSYSAPI void WINAPI TpReleaseWork(TP_WORK *);
+NTSYSAPI void WINAPI TpSetPoolMaxThreads(TP_POOL *,DWORD);
+NTSYSAPI BOOL WINAPI TpSetPoolMinThreads(TP_POOL *,DWORD);
NTSYSAPI void WINAPI TpSetTimer(TP_TIMER *, LARGE_INTEGER *,LONG,LONG);
+NTSYSAPI NTSTATUS WINAPI TpSimpleTryPost(PTP_SIMPLE_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *);
NTSYSAPI void WINAPI TpWaitForTimer(TP_TIMER *,BOOL);
NTSYSAPI void WINAPI TpWaitForWork(TP_WORK *,BOOL);
More information about the wine-cvs
mailing list