mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-15 05:29:10 +08:00
Cygwin: pipe: handle signals explicitely in raw_write
The simple cygwait call in fhandler_pipe_fifo::raw_write doesn't take the SA_RESTART setting into account. Move handling the signal into raw_write. Fixes: 4b25687ea3ee2 ("Cygwin: fhandler_pipe: add raw_read and raw_write") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
54a6a90234
commit
3d9eb1b2c5
@ -483,9 +483,16 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
|
|||||||
(PVOID) ptr, len1, NULL, NULL);
|
(PVOID) ptr, len1, NULL, NULL);
|
||||||
if (status == STATUS_PENDING)
|
if (status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
while (WAIT_TIMEOUT ==
|
do
|
||||||
(waitret = cygwait (evt, (DWORD) 0, cw_cancel | cw_sig)))
|
|
||||||
{
|
{
|
||||||
|
/* To allow constant reader_closed() checking even if the
|
||||||
|
signal has been set up with SA_RESTART, we're handling
|
||||||
|
the signal here --> cw_sig_eintr. */
|
||||||
|
waitret = cygwait (evt, (DWORD) 0, cw_cancel | cw_sig_eintr);
|
||||||
|
/* Break out if no SA_RESTART. */
|
||||||
|
if (waitret == WAIT_SIGNALED
|
||||||
|
&& !_my_tls.call_signal_handler ())
|
||||||
|
break;
|
||||||
if (reader_closed ())
|
if (reader_closed ())
|
||||||
{
|
{
|
||||||
CancelIo (get_handle ());
|
CancelIo (get_handle ());
|
||||||
@ -494,8 +501,10 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cygwait (select_sem, 10);
|
cygwait (select_sem, 10, cw_cancel);
|
||||||
}
|
}
|
||||||
|
/* Loop in case of blocking write or SA_RESTART */
|
||||||
|
while (waitret == WAIT_TIMEOUT || waitret == WAIT_SIGNALED);
|
||||||
/* If io.Status is STATUS_CANCELLED after CancelIo, IO has
|
/* If io.Status is STATUS_CANCELLED after CancelIo, IO has
|
||||||
actually been cancelled and io.Information contains the
|
actually been cancelled and io.Information contains the
|
||||||
number of bytes processed so far.
|
number of bytes processed so far.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user