services: Remove synchronization for CloseThreadpoolCleanupGroupMembers.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Sebastian Lackner 2016-08-20 21:24:52 +02:00 committed by Alexandre Julliard
parent a9f648ef69
commit bc8f74f92f
1 changed files with 8 additions and 20 deletions

View File

@ -85,30 +85,22 @@ struct sc_lock
struct scmdatabase *db;
};
static CRITICAL_SECTION shutdown_cs;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &shutdown_cs,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": shutdown_cs") }
};
static CRITICAL_SECTION shutdown_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
static BOOL service_shutdown;
static PTP_CLEANUP_GROUP cleanup_group;
HANDLE exit_event;
static void CALLBACK group_cancel_callback(void *object, void *userdata)
{
struct process_entry *process = object;
release_process(process);
}
static void CALLBACK terminate_callback(TP_CALLBACK_INSTANCE *instance, void *context,
TP_WAIT *wait, TP_WAIT_RESULT result)
{
struct process_entry *process = context;
if (result == WAIT_TIMEOUT) process_terminate(process);
release_process(process);
/* synchronize with CloseThreadpoolCleanupGroupMembers */
EnterCriticalSection(&shutdown_cs);
if (!service_shutdown) CloseThreadpoolWait(wait);
LeaveCriticalSection(&shutdown_cs);
CloseThreadpoolWait(wait);
}
static void terminate_after_timeout(struct process_entry *process, DWORD timeout)
@ -121,6 +113,7 @@ static void terminate_after_timeout(struct process_entry *process, DWORD timeout
memset(&environment, 0, sizeof(environment));
environment.Version = 1;
environment.CleanupGroup = cleanup_group;
environment.CleanupGroupCancelCallback = group_cancel_callback;
timestamp.QuadPart = (ULONGLONG)timeout * -10000;
ft.dwLowDateTime = timestamp.u.LowPart;
@ -1914,11 +1907,6 @@ void RPC_Stop(void)
RpcMgmtStopServerListening(NULL);
RpcServerUnregisterIf(svcctl_v2_0_s_ifspec, NULL, TRUE);
/* synchronize with CloseThreadpoolWait */
EnterCriticalSection(&shutdown_cs);
service_shutdown = TRUE;
LeaveCriticalSection(&shutdown_cs);
CloseThreadpoolCleanupGroupMembers(cleanup_group, TRUE, NULL);
CloseThreadpoolCleanupGroup(cleanup_group);
CloseHandle(exit_event);