ntdll: Implement TpCallbackSetEventOnCompletion.

This commit is contained in:
Sebastian Lackner 2015-07-01 22:57:53 +02:00 committed by Alexandre Julliard
parent 3dc1c6442a
commit 15110b1770
2 changed files with 22 additions and 1 deletions

View File

@ -977,6 +977,7 @@
@ stdcall TpCallbackMayRunLong(ptr)
@ stdcall TpCallbackReleaseMutexOnCompletion(ptr long)
@ stdcall TpCallbackReleaseSemaphoreOnCompletion(ptr long long)
@ stdcall TpCallbackSetEventOnCompletion(ptr long)
@ stdcall TpPostWork(ptr)
@ stdcall TpReleaseCleanupGroup(ptr)
@ stdcall TpReleaseCleanupGroupMembers(ptr long ptr)

View File

@ -209,6 +209,7 @@ struct threadpool_instance
HANDLE mutex;
HANDLE semaphore;
LONG semaphore_count;
HANDLE event;
} cleanup;
};
@ -1642,6 +1643,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
instance.cleanup.mutex = NULL;
instance.cleanup.semaphore = NULL;
instance.cleanup.semaphore_count = 0;
instance.cleanup.event = NULL;
switch (object->type)
{
@ -1689,7 +1691,12 @@ static void CALLBACK threadpool_worker_proc( void *param )
}
if (instance.cleanup.semaphore)
{
NtReleaseSemaphore( instance.cleanup.semaphore, instance.cleanup.semaphore_count, NULL );
status = NtReleaseSemaphore( instance.cleanup.semaphore, instance.cleanup.semaphore_count, NULL );
if (status != STATUS_SUCCESS) goto skip_cleanup;
}
if (instance.cleanup.event)
{
NtSetEvent( instance.cleanup.event, NULL );
}
skip_cleanup:
@ -1872,6 +1879,19 @@ VOID WINAPI TpCallbackReleaseSemaphoreOnCompletion( TP_CALLBACK_INSTANCE *instan
}
}
/***********************************************************************
* TpCallbackSetEventOnCompletion (NTDLL.@)
*/
VOID WINAPI TpCallbackSetEventOnCompletion( TP_CALLBACK_INSTANCE *instance, HANDLE event )
{
struct threadpool_instance *this = impl_from_TP_CALLBACK_INSTANCE( instance );
TRACE( "%p %p\n", instance, event );
if (!this->cleanup.event)
this->cleanup.event = event;
}
/***********************************************************************
* TpPostWork (NTDLL.@)
*/