ntdll: Implement TpSetPoolMinThreads.
This commit is contained in:
parent
d56984a03d
commit
7d9ec31e19
|
@ -973,6 +973,7 @@
|
||||||
@ stdcall TpAllocPool(ptr ptr)
|
@ stdcall TpAllocPool(ptr ptr)
|
||||||
@ stdcall TpReleasePool(ptr)
|
@ stdcall TpReleasePool(ptr)
|
||||||
@ stdcall TpSetPoolMaxThreads(ptr long)
|
@ stdcall TpSetPoolMaxThreads(ptr long)
|
||||||
|
@ stdcall TpSetPoolMinThreads(ptr long)
|
||||||
@ stdcall TpSimpleTryPost(ptr ptr ptr)
|
@ stdcall TpSimpleTryPost(ptr ptr ptr)
|
||||||
@ stdcall -ret64 VerSetConditionMask(int64 long long)
|
@ stdcall -ret64 VerSetConditionMask(int64 long long)
|
||||||
@ stdcall WinSqmIsOptedIn()
|
@ stdcall WinSqmIsOptedIn()
|
||||||
|
|
|
@ -1480,6 +1480,41 @@ VOID WINAPI TpSetPoolMaxThreads( TP_POOL *pool, DWORD maximum )
|
||||||
RtlLeaveCriticalSection( &this->cs );
|
RtlLeaveCriticalSection( &this->cs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* TpSetPoolMinThreads (NTDLL.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
|
||||||
|
{
|
||||||
|
struct threadpool *this = impl_from_TP_POOL( pool );
|
||||||
|
NTSTATUS status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
TRACE( "%p %u\n", pool, minimum );
|
||||||
|
|
||||||
|
RtlEnterCriticalSection( &this->cs );
|
||||||
|
|
||||||
|
while (this->num_workers < minimum)
|
||||||
|
{
|
||||||
|
HANDLE thread;
|
||||||
|
status = RtlCreateUserThread( GetCurrentProcess(), NULL, FALSE, NULL, 0, 0,
|
||||||
|
threadpool_worker_proc, this, &thread, NULL );
|
||||||
|
if (status != STATUS_SUCCESS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
interlocked_inc( &this->refcount );
|
||||||
|
this->num_workers++;
|
||||||
|
NtClose( thread );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
this->min_workers = minimum;
|
||||||
|
this->max_workers = max( this->min_workers, this->max_workers );
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlLeaveCriticalSection( &this->cs );
|
||||||
|
return !status;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* TpSimpleTryPost (NTDLL.@)
|
* TpSimpleTryPost (NTDLL.@)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue