Cygwin: FIFO: avoid WFMO error in listen_client_thread
Don't set lct_termination_evt to NULL too early in fhandler_fifo::stop_listen_client. Doing so leads to an "Invalid Handle" error in WFMO.
This commit is contained in:
parent
ef269531a9
commit
24c56e5a2c
@ -844,22 +844,24 @@ int
|
|||||||
fhandler_fifo::stop_listen_client ()
|
fhandler_fifo::stop_listen_client ()
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
HANDLE evt = InterlockedExchangePointer (&lct_termination_evt, NULL);
|
HANDLE thr, evt;
|
||||||
HANDLE thr = InterlockedExchangePointer (&listen_client_thr, NULL);
|
|
||||||
|
thr = InterlockedExchangePointer (&listen_client_thr, NULL);
|
||||||
if (thr)
|
if (thr)
|
||||||
{
|
{
|
||||||
if (evt)
|
if (lct_termination_evt)
|
||||||
SetEvent (evt);
|
SetEvent (lct_termination_evt);
|
||||||
WaitForSingleObject (thr, INFINITE);
|
WaitForSingleObject (thr, INFINITE);
|
||||||
DWORD err;
|
DWORD err;
|
||||||
GetExitCodeThread (thr, &err);
|
GetExitCodeThread (thr, &err);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
ret = -1;
|
ret = -1;
|
||||||
debug_printf ("listen_client_thread exited with error, %E");
|
debug_printf ("listen_client_thread exited with error");
|
||||||
}
|
}
|
||||||
CloseHandle (thr);
|
CloseHandle (thr);
|
||||||
}
|
}
|
||||||
|
evt = InterlockedExchangePointer (&lct_termination_evt, NULL);
|
||||||
if (evt)
|
if (evt)
|
||||||
CloseHandle (evt);
|
CloseHandle (evt);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user