4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 04:49:25 +08:00

Cygwin: FIFO: avoid deadlock when closing

fhandler_fifo::close could be called from a signal handler or another
thread at a time when another function is holding the fifo_client
lock.  This could prevent the listen_client thread from acting on the
thread termination event.  Avoid a deadlock by calling
fifo_client_unlock at the beginning of fhandler_fifo::close.
This commit is contained in:
Ken Brown 2019-06-22 13:58:12 -04:00
parent a92e5ecd0d
commit 027adac187

View File

@ -928,6 +928,9 @@ fhandler_fifo::stop_listen_client ()
int
fhandler_fifo::close ()
{
/* Avoid deadlock with lct in case this is called from a signal
handler or another thread. */
fifo_client_unlock ();
int ret = stop_listen_client ();
if (read_ready)
CloseHandle (read_ready);