Fix Thread handle leak

When a thread pool is release the Thread handle is leaked.
This commit is contained in:
Hardening 2014-04-23 16:59:14 +02:00
parent 5391275f66
commit 9d2ea1fcd8

View File

@ -103,6 +103,11 @@ static void* thread_pool_work_func(void* arg)
return NULL;
}
static void threads_close(void *thread)
{
CloseHandle(thread);
}
void InitializeThreadpool(PTP_POOL pool)
{
int index;
@ -114,6 +119,7 @@ void InitializeThreadpool(PTP_POOL pool)
pool->Maximum = 500;
pool->Threads = ArrayList_New(TRUE);
pool->Threads->object.fnObjectFree = threads_close;
pool->PendingQueue = Queue_New(TRUE, -1, -1);
pool->WorkComplete = CountdownEvent_New(0);