Commit bc8f74f9 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

services: Remove synchronization for CloseThreadpoolCleanupGroupMembers.

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