Cygwin: FIFO: dup/fork/exec: make sure child starts unlocked
There can be deadlocks if the child starts with its fifo_client_lock in the locked state.
This commit is contained in:
parent
624fda1e96
commit
13c65c43c2
@ -981,6 +981,9 @@ fhandler_fifo::dup (fhandler_base *child, int flags)
|
|||||||
}
|
}
|
||||||
if (reader)
|
if (reader)
|
||||||
{
|
{
|
||||||
|
/* Make sure the child starts unlocked. */
|
||||||
|
fhf->fifo_client_unlock ();
|
||||||
|
|
||||||
fifo_client_lock ();
|
fifo_client_lock ();
|
||||||
for (i = 0; i < nhandlers; i++)
|
for (i = 0; i < nhandlers; i++)
|
||||||
{
|
{
|
||||||
@ -1025,20 +1028,32 @@ fhandler_fifo::fixup_after_fork (HANDLE parent)
|
|||||||
fhandler_base::fixup_after_fork (parent);
|
fhandler_base::fixup_after_fork (parent);
|
||||||
fork_fixup (parent, read_ready, "read_ready");
|
fork_fixup (parent, read_ready, "read_ready");
|
||||||
fork_fixup (parent, write_ready, "write_ready");
|
fork_fixup (parent, write_ready, "write_ready");
|
||||||
fifo_client_lock ();
|
if (reader)
|
||||||
for (int i = 0; i < nhandlers; i++)
|
{
|
||||||
fork_fixup (parent, fc_handler[i].h, "fc_handler[].h");
|
/* Make sure the child starts unlocked. */
|
||||||
fifo_client_unlock ();
|
fifo_client_unlock ();
|
||||||
if (reader && !listen_client ())
|
|
||||||
debug_printf ("failed to start lct, %E");
|
fifo_client_lock ();
|
||||||
|
for (int i = 0; i < nhandlers; i++)
|
||||||
|
fork_fixup (parent, fc_handler[i].h, "fc_handler[].h");
|
||||||
|
fifo_client_unlock ();
|
||||||
|
if (!listen_client ())
|
||||||
|
debug_printf ("failed to start lct, %E");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_fifo::fixup_after_exec ()
|
fhandler_fifo::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
fhandler_base::fixup_after_exec ();
|
fhandler_base::fixup_after_exec ();
|
||||||
if (reader && !listen_client ())
|
if (reader && !close_on_exec ())
|
||||||
debug_printf ("failed to start lct, %E");
|
{
|
||||||
|
/* Make sure the child starts unlocked. */
|
||||||
|
fifo_client_unlock ();
|
||||||
|
|
||||||
|
if (!listen_client ())
|
||||||
|
debug_printf ("failed to start lct, %E");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user