mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-23 00:59:51 +08:00
Cygwin: FIFO: improve the interruptibility of raw_read
During a blocking read, we sleep for 1 ms after each iteration through the connected writers. Currently we do this by calling Sleep (1). Remove this call to Sleep and instead change the timeout in the cygwait call from 0 to 1, so that raw_read can be interrupted while sleeping.
This commit is contained in:
parent
cd402773ce
commit
a557b50d73
@ -1335,8 +1335,8 @@ fhandler_fifo::raw_read (void *in_ptr, size_t& len)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Allow interruption. */
|
/* Allow interruption and don't hog the CPU. */
|
||||||
DWORD waitret = cygwait (NULL, cw_nowait, cw_cancel | cw_sig_eintr);
|
DWORD waitret = cygwait (NULL, 1, cw_cancel | cw_sig_eintr);
|
||||||
if (waitret == WAIT_CANCELED)
|
if (waitret == WAIT_CANCELED)
|
||||||
pthread::static_cancel_self ();
|
pthread::static_cancel_self ();
|
||||||
else if (waitret == WAIT_SIGNALED)
|
else if (waitret == WAIT_SIGNALED)
|
||||||
@ -1356,8 +1356,6 @@ fhandler_fifo::raw_read (void *in_ptr, size_t& len)
|
|||||||
set_errno (EBADF);
|
set_errno (EBADF);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
/* Don't hog the CPU. */
|
|
||||||
Sleep (1);
|
|
||||||
}
|
}
|
||||||
errout:
|
errout:
|
||||||
len = (size_t) -1;
|
len = (size_t) -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user