Commit b2f5b034 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ntdll: Add threadpool stack information exports.

parent f6425471
......@@ -1070,6 +1070,7 @@
@ stdcall TpDisassociateCallback(ptr)
@ stdcall TpIsTimerSet(ptr)
@ stdcall TpPostWork(ptr)
@ stdcall TpQueryPoolStackInformation(ptr ptr)
@ stdcall TpReleaseCleanupGroup(ptr)
@ stdcall TpReleaseCleanupGroupMembers(ptr long ptr)
@ stdcall TpReleasePool(ptr)
......@@ -1078,6 +1079,7 @@
@ stdcall TpReleaseWork(ptr)
@ stdcall TpSetPoolMaxThreads(ptr long)
@ stdcall TpSetPoolMinThreads(ptr long)
@ stdcall TpSetPoolStackInformation(ptr ptr)
@ stdcall TpSetTimer(ptr ptr long long)
@ stdcall TpSetWait(ptr long ptr)
@ stdcall TpSimpleTryPost(ptr ptr ptr)
......
......@@ -131,6 +131,7 @@ struct threadpool
int min_workers;
int num_workers;
int num_busy_workers;
TP_POOL_STACK_INFORMATION stack_info;
};
enum threadpool_objtype
......@@ -1648,6 +1649,7 @@ static void tp_waitqueue_unlock( struct threadpool_object *wait )
*/
static NTSTATUS tp_threadpool_alloc( struct threadpool **out )
{
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress );
struct threadpool *pool;
unsigned int i;
......@@ -1666,10 +1668,12 @@ static NTSTATUS tp_threadpool_alloc( struct threadpool **out )
list_init( &pool->pools[i] );
RtlInitializeConditionVariable( &pool->update_event );
pool->max_workers = 500;
pool->min_workers = 0;
pool->num_workers = 0;
pool->num_busy_workers = 0;
pool->max_workers = 500;
pool->min_workers = 0;
pool->num_workers = 0;
pool->num_busy_workers = 0;
pool->stack_info.StackReserve = nt->OptionalHeader.SizeOfStackReserve;
pool->stack_info.StackCommit = nt->OptionalHeader.SizeOfStackCommit;
TRACE( "allocated threadpool %p\n", pool );
......@@ -2989,3 +2993,41 @@ VOID WINAPI TpWaitForWork( TP_WORK *work, BOOL cancel_pending )
tp_object_cancel( this );
tp_object_wait( this, FALSE );
}
/***********************************************************************
* TpSetPoolStackInformation (NTDLL.@)
*/
NTSTATUS WINAPI TpSetPoolStackInformation( TP_POOL *pool, TP_POOL_STACK_INFORMATION *stack_info )
{
struct threadpool *this = impl_from_TP_POOL( pool );
TRACE( "%p %p\n", pool, stack_info );
if (!stack_info)
return STATUS_INVALID_PARAMETER;
RtlEnterCriticalSection( &this->cs );
this->stack_info = *stack_info;
RtlLeaveCriticalSection( &this->cs );
return STATUS_SUCCESS;
}
/***********************************************************************
* TpQueryPoolStackInformation (NTDLL.@)
*/
NTSTATUS WINAPI TpQueryPoolStackInformation( TP_POOL *pool, TP_POOL_STACK_INFORMATION *stack_info )
{
struct threadpool *this = impl_from_TP_POOL( pool );
TRACE( "%p %p\n", pool, stack_info );
if (!stack_info)
return STATUS_INVALID_PARAMETER;
RtlEnterCriticalSection( &this->cs );
*stack_info = this->stack_info;
RtlLeaveCriticalSection( &this->cs );
return STATUS_SUCCESS;
}
......@@ -3021,6 +3021,7 @@ NTSYSAPI void WINAPI TpCallbackUnloadDllOnCompletion(TP_CALLBACK_INSTANCE *
NTSYSAPI void WINAPI TpDisassociateCallback(TP_CALLBACK_INSTANCE *);
NTSYSAPI BOOL WINAPI TpIsTimerSet(TP_TIMER *);
NTSYSAPI void WINAPI TpPostWork(TP_WORK *);
NTSYSAPI NTSTATUS WINAPI TpQueryPoolStackInformation(TP_POOL *, TP_POOL_STACK_INFORMATION *stack_info);
NTSYSAPI void WINAPI TpReleaseCleanupGroup(TP_CLEANUP_GROUP *);
NTSYSAPI void WINAPI TpReleaseCleanupGroupMembers(TP_CLEANUP_GROUP *,BOOL,PVOID);
NTSYSAPI void WINAPI TpReleasePool(TP_POOL *);
......@@ -3029,6 +3030,7 @@ NTSYSAPI void WINAPI TpReleaseWait(TP_WAIT *);
NTSYSAPI void WINAPI TpReleaseWork(TP_WORK *);
NTSYSAPI void WINAPI TpSetPoolMaxThreads(TP_POOL *,DWORD);
NTSYSAPI BOOL WINAPI TpSetPoolMinThreads(TP_POOL *,DWORD);
NTSYSAPI NTSTATUS WINAPI TpSetPoolStackInformation(TP_POOL *, TP_POOL_STACK_INFORMATION *stack_info);
NTSYSAPI void WINAPI TpSetTimer(TP_TIMER *, LARGE_INTEGER *,LONG,LONG);
NTSYSAPI void WINAPI TpSetWait(TP_WAIT *,HANDLE,LARGE_INTEGER *);
NTSYSAPI NTSTATUS WINAPI TpSimpleTryPost(PTP_SIMPLE_CALLBACK,PVOID,TP_CALLBACK_ENVIRON *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment