]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: FIFO: avoid WFMO error in listen_client_thread
authorKen Brown <kbrown@cornell.edu>
Sat, 20 Apr 2019 15:22:29 +0000 (11:22 -0400)
committerKen Brown <kbrown@cornell.edu>
Sat, 20 Apr 2019 18:31:07 +0000 (14:31 -0400)
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.

winsup/cygwin/fhandler_fifo.cc

index 0a6dc059109c37c84c82be3df0e2b90d544c667a..0e4bf3aee42cd6f9fe5e1b73900edc7f982c2ac6 100644 (file)
@@ -844,22 +844,24 @@ int
 fhandler_fifo::stop_listen_client ()
 {
   int ret = 0;
-  HANDLE evt = InterlockedExchangePointer (&lct_termination_evt, NULL);
-  HANDLE thr = InterlockedExchangePointer (&listen_client_thr, NULL);
+  HANDLE thr, evt;
+
+  thr = InterlockedExchangePointer (&listen_client_thr, NULL);
   if (thr)
     {
-      if (evt)
-       SetEvent (evt);
+      if (lct_termination_evt)
+       SetEvent (lct_termination_evt);
       WaitForSingleObject (thr, INFINITE);
       DWORD err;
       GetExitCodeThread (thr, &err);
       if (err)
        {
          ret = -1;
-         debug_printf ("listen_client_thread exited with error, %E");
+         debug_printf ("listen_client_thread exited with error");
        }
       CloseHandle (thr);
     }
+  evt = InterlockedExchangePointer (&lct_termination_evt, NULL);
   if (evt)
     CloseHandle (evt);
   return ret;
This page took 0.034922 seconds and 5 git commands to generate.