mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
launcher: fix deadlock when SvcPipeServer stops itself
This commit is contained in:
parent
0756649572
commit
ec2494433b
@ -455,6 +455,7 @@ NTSTATUS SvcInstanceGetNameList(HANDLE ClientToken,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE SvcThread, SvcEvent;
|
static HANDLE SvcThread, SvcEvent;
|
||||||
|
static DWORD SvcThreadId;
|
||||||
static HANDLE SvcPipe = INVALID_HANDLE_VALUE;
|
static HANDLE SvcPipe = INVALID_HANDLE_VALUE;
|
||||||
static OVERLAPPED SvcOverlapped;
|
static OVERLAPPED SvcOverlapped;
|
||||||
|
|
||||||
@ -491,7 +492,7 @@ static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
|
|||||||
if (INVALID_HANDLE_VALUE == SvcPipe)
|
if (INVALID_HANDLE_VALUE == SvcPipe)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
SvcThread = CreateThread(0, 0, SvcPipeServer, Service, 0, 0);
|
SvcThread = CreateThread(0, 0, SvcPipeServer, Service, 0, &SvcThreadId);
|
||||||
if (0 == SvcThread)
|
if (0 == SvcThread)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@ -523,9 +524,12 @@ fail:
|
|||||||
|
|
||||||
static NTSTATUS SvcStop(FSP_SERVICE *Service)
|
static NTSTATUS SvcStop(FSP_SERVICE *Service)
|
||||||
{
|
{
|
||||||
SetEvent(SvcEvent);
|
if (GetCurrentThreadId() != SvcThreadId)
|
||||||
FspServiceRequestTime(Service, 4500); /* just under 5 sec */
|
{
|
||||||
WaitForSingleObject(SvcThread, 4500);
|
SetEvent(SvcEvent);
|
||||||
|
FspServiceRequestTime(Service, 4500); /* just under 5 sec */
|
||||||
|
WaitForSingleObject(SvcThread, 4500);
|
||||||
|
}
|
||||||
|
|
||||||
if (0 != SvcThread)
|
if (0 != SvcThread)
|
||||||
CloseHandle(SvcThread);
|
CloseHandle(SvcThread);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user