kernel32: Move thread pool functions to kernelbase.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-08-08 14:25:58 +02:00
parent 0116660dd8
commit 296da1fbb1
4 changed files with 105 additions and 190 deletions

View File

@ -329,12 +329,12 @@
@ stdcall CreateSymbolicLinkW(wstr wstr long)
@ stdcall CreateTapePartition(long long long long)
@ stdcall -import CreateThread(ptr long ptr long long ptr)
@ stdcall CreateThreadpool(ptr)
@ stdcall CreateThreadpoolCleanupGroup()
@ stdcall CreateThreadpoolIo(ptr ptr ptr ptr)
@ stdcall CreateThreadpoolTimer(ptr ptr ptr)
@ stdcall CreateThreadpoolWait(ptr ptr ptr)
@ stdcall CreateThreadpoolWork(ptr ptr ptr)
@ stdcall -import CreateThreadpool(ptr)
@ stdcall -import CreateThreadpoolCleanupGroup()
@ stdcall -import CreateThreadpoolIo(ptr ptr ptr ptr)
@ stdcall -import CreateThreadpoolTimer(ptr ptr ptr)
@ stdcall -import CreateThreadpoolWait(ptr ptr ptr)
@ stdcall -import CreateThreadpoolWork(ptr ptr ptr)
@ stdcall -import CreateTimerQueue()
@ stdcall -import CreateTimerQueueTimer(ptr long ptr ptr long long long)
@ stdcall CreateToolhelp32Snapshot(long long)
@ -1462,8 +1462,8 @@
# @ stub SetThreadpoolStackInformation
@ stdcall SetThreadpoolThreadMaximum(ptr long) ntdll.TpSetPoolMaxThreads
@ stdcall SetThreadpoolThreadMinimum(ptr long) ntdll.TpSetPoolMinThreads
@ stdcall SetThreadpoolTimer(ptr ptr long long)
@ stdcall SetThreadpoolWait(ptr long ptr)
@ stdcall SetThreadpoolTimer(ptr ptr long long) ntdll.TpSetTimer
@ stdcall SetThreadpoolWait(ptr long ptr) ntdll.TpSetWait
@ stdcall SetTimeZoneInformation(ptr)
@ stub SetTimerQueueTimer
@ stdcall -arch=x86_64 SetUmsThreadInformation(ptr long ptr long)
@ -1515,7 +1515,7 @@
@ stdcall TryAcquireSRWLockExclusive(ptr) ntdll.RtlTryAcquireSRWLockExclusive
@ stdcall TryAcquireSRWLockShared(ptr) ntdll.RtlTryAcquireSRWLockShared
@ stdcall TryEnterCriticalSection(ptr) ntdll.RtlTryEnterCriticalSection
@ stdcall TrySubmitThreadpoolCallback(ptr ptr ptr)
@ stdcall -import TrySubmitThreadpoolCallback(ptr ptr ptr)
@ stdcall TzSpecificLocalTimeToSystemTime(ptr ptr ptr)
# @ stub TzSpecificLocalTimeToSystemTimeEx
# @ stub -arch=x86_64 uaw_lstrcmpW

View File

@ -242,177 +242,3 @@ BOOL WINAPI CallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
return TRUE;
}
/***********************************************************************
* 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 )
{
TP_CLEANUP_GROUP *group;
NTSTATUS status;
TRACE( "\n" );
status = TpAllocCleanupGroup( &group );
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
return NULL;
}
return group;
}
/***********************************************************************
* CreateThreadpoolIo (KERNEL32.@)
*/
PTP_IO WINAPI CreateThreadpoolIo( HANDLE handle, PTP_WIN32_IO_CALLBACK callback,
PVOID userdata, TP_CALLBACK_ENVIRON *environment )
{
FIXME("(%p, %p, %p, %p): stub\n", handle, callback, userdata, environment);
return FALSE;
}
/***********************************************************************
* CreateThreadpoolTimer (KERNEL32.@)
*/
PTP_TIMER WINAPI CreateThreadpoolTimer( PTP_TIMER_CALLBACK callback, PVOID userdata,
TP_CALLBACK_ENVIRON *environment )
{
TP_TIMER *timer;
NTSTATUS status;
TRACE( "%p, %p, %p\n", callback, userdata, environment );
status = TpAllocTimer( &timer, callback, userdata, environment );
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
return NULL;
}
return timer;
}
/***********************************************************************
* CreateThreadpoolWait (KERNEL32.@)
*/
PTP_WAIT WINAPI CreateThreadpoolWait( PTP_WAIT_CALLBACK callback, PVOID userdata,
TP_CALLBACK_ENVIRON *environment )
{
TP_WAIT *wait;
NTSTATUS status;
TRACE( "%p, %p, %p\n", callback, userdata, environment );
status = TpAllocWait( &wait, callback, userdata, environment );
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
return NULL;
}
return wait;
}
/***********************************************************************
* CreateThreadpoolWork (KERNEL32.@)
*/
PTP_WORK WINAPI CreateThreadpoolWork( PTP_WORK_CALLBACK callback, PVOID userdata,
TP_CALLBACK_ENVIRON *environment )
{
TP_WORK *work;
NTSTATUS status;
TRACE( "%p, %p, %p\n", callback, userdata, environment );
status = TpAllocWork( &work, callback, userdata, environment );
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
return NULL;
}
return work;
}
/***********************************************************************
* SetThreadpoolTimer (KERNEL32.@)
*/
VOID WINAPI SetThreadpoolTimer( TP_TIMER *timer, FILETIME *due_time,
DWORD period, DWORD window_length )
{
LARGE_INTEGER timeout;
TRACE( "%p, %p, %u, %u\n", timer, due_time, period, window_length );
if (due_time)
{
timeout.u.LowPart = due_time->dwLowDateTime;
timeout.u.HighPart = due_time->dwHighDateTime;
}
TpSetTimer( timer, due_time ? &timeout : NULL, period, window_length );
}
/***********************************************************************
* SetThreadpoolWait (KERNEL32.@)
*/
VOID WINAPI SetThreadpoolWait( TP_WAIT *wait, HANDLE handle, FILETIME *due_time )
{
LARGE_INTEGER timeout;
TRACE( "%p, %p, %p\n", wait, handle, due_time );
if (!handle)
{
due_time = NULL;
}
else if (due_time)
{
timeout.u.LowPart = due_time->dwLowDateTime;
timeout.u.HighPart = due_time->dwHighDateTime;
}
TpSetWait( wait, handle, due_time ? &timeout : NULL );
}
/***********************************************************************
* 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;
}

View File

@ -223,12 +223,12 @@
# @ stub CreateStateSubcontainer
@ stdcall CreateSymbolicLinkW(wstr wstr long) kernel32.CreateSymbolicLinkW
@ stdcall CreateThread(ptr long ptr long long ptr)
@ stdcall CreateThreadpool(ptr) kernel32.CreateThreadpool
@ stdcall CreateThreadpoolCleanupGroup() kernel32.CreateThreadpoolCleanupGroup
@ stdcall CreateThreadpoolIo(ptr ptr ptr ptr) kernel32.CreateThreadpoolIo
@ stdcall CreateThreadpoolTimer(ptr ptr ptr) kernel32.CreateThreadpoolTimer
@ stdcall CreateThreadpoolWait(ptr ptr ptr) kernel32.CreateThreadpoolWait
@ stdcall CreateThreadpoolWork(ptr ptr ptr) kernel32.CreateThreadpoolWork
@ stdcall CreateThreadpool(ptr)
@ stdcall CreateThreadpoolCleanupGroup()
@ stdcall CreateThreadpoolIo(ptr ptr ptr ptr)
@ stdcall CreateThreadpoolTimer(ptr ptr ptr)
@ stdcall CreateThreadpoolWait(ptr ptr ptr)
@ stdcall CreateThreadpoolWork(ptr ptr ptr)
@ stdcall CreateTimerQueue()
@ stdcall CreateTimerQueueTimer(ptr long ptr ptr long long long)
@ stdcall CreateWaitableTimerExW(ptr wstr long long)
@ -1609,7 +1609,7 @@
@ stdcall TryAcquireSRWLockExclusive(ptr) ntdll.RtlTryAcquireSRWLockExclusive
@ stdcall TryAcquireSRWLockShared(ptr) ntdll.RtlTryAcquireSRWLockShared
@ stdcall TryEnterCriticalSection(ptr) ntdll.RtlTryEnterCriticalSection
@ stdcall TrySubmitThreadpoolCallback(ptr ptr ptr) kernel32.TrySubmitThreadpoolCallback
@ stdcall TrySubmitThreadpoolCallback(ptr ptr ptr)
@ stdcall TzSpecificLocalTimeToSystemTime(ptr ptr ptr) kernel32.TzSpecificLocalTimeToSystemTime
@ stub TzSpecificLocalTimeToSystemTimeEx
@ stdcall UnhandledExceptionFilter(ptr) kernel32.UnhandledExceptionFilter

View File

@ -493,3 +493,92 @@ BOOL WINAPI DECLSPEC_HOTPATCH TerminateThread( HANDLE handle, DWORD exit_code )
{
return set_ntstatus( NtTerminateThread( handle, exit_code ));
}
/***********************************************************************
* Thread pool
***********************************************************************/
/***********************************************************************
* CreateThreadpool (kernelbase.@)
*/
PTP_POOL WINAPI DECLSPEC_HOTPATCH CreateThreadpool( void *reserved )
{
TP_POOL *pool;
if (!set_ntstatus( TpAllocPool( &pool, reserved ))) pool = NULL;
return pool;
}
/***********************************************************************
* CreateThreadpoolCleanupGroup (kernelbase.@)
*/
PTP_CLEANUP_GROUP WINAPI DECLSPEC_HOTPATCH CreateThreadpoolCleanupGroup(void)
{
TP_CLEANUP_GROUP *group;
if (!set_ntstatus( TpAllocCleanupGroup( &group ))) return NULL;
return group;
}
/***********************************************************************
* CreateThreadpoolIo (kernelbase.@)
*/
PTP_IO WINAPI DECLSPEC_HOTPATCH CreateThreadpoolIo( HANDLE handle, PTP_WIN32_IO_CALLBACK callback,
PVOID userdata, TP_CALLBACK_ENVIRON *environment )
{
FIXME( "(%p, %p, %p, %p): stub\n", handle, callback, userdata, environment );
return FALSE;
}
/***********************************************************************
* CreateThreadpoolTimer (kernelbase.@)
*/
PTP_TIMER WINAPI DECLSPEC_HOTPATCH CreateThreadpoolTimer( PTP_TIMER_CALLBACK callback, PVOID userdata,
TP_CALLBACK_ENVIRON *environment )
{
TP_TIMER *timer;
if (!set_ntstatus( TpAllocTimer( &timer, callback, userdata, environment ))) return NULL;
return timer;
}
/***********************************************************************
* CreateThreadpoolWait (kernelbase.@)
*/
PTP_WAIT WINAPI DECLSPEC_HOTPATCH CreateThreadpoolWait( PTP_WAIT_CALLBACK callback, PVOID userdata,
TP_CALLBACK_ENVIRON *environment )
{
TP_WAIT *wait;
if (!set_ntstatus( TpAllocWait( &wait, callback, userdata, environment ))) return NULL;
return wait;
}
/***********************************************************************
* CreateThreadpoolWork (kernelbase.@)
*/
PTP_WORK WINAPI DECLSPEC_HOTPATCH CreateThreadpoolWork( PTP_WORK_CALLBACK callback, PVOID userdata,
TP_CALLBACK_ENVIRON *environment )
{
TP_WORK *work;
if (!set_ntstatus( TpAllocWork( &work, callback, userdata, environment ))) return NULL;
return work;
}
/***********************************************************************
* TrySubmitThreadpoolCallback (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH TrySubmitThreadpoolCallback( PTP_SIMPLE_CALLBACK callback, PVOID userdata,
TP_CALLBACK_ENVIRON *environment )
{
return set_ntstatus( TpSimpleTryPost( callback, userdata, environment ));
}