]> sourceware.org Git - newlib-cygwin.git/commit
Cygwin: FIFO: add a timeout to take_ownership
authorKen Brown <kbrown@cornell.edu>
Mon, 3 Aug 2020 13:17:06 +0000 (09:17 -0400)
committerKen Brown <kbrown@cornell.edu>
Tue, 4 Aug 2020 12:15:19 +0000 (08:15 -0400)
commit6ed067a0ae5c39b43c8a77433e4c8ca30f87020a
tree027d97208e6f2fd2e6c62ca82a972a43a18cf9c1
parent6acce025d07aa9328968351e1b718c0974e8780d
Cygwin: FIFO: add a timeout to take_ownership

fhandler_fifo::take_ownership() is called from select.cc::peek_fifo
and fhandler_fifo::raw_read and could potentially block indefinitely
if something goes wrong.  This is always undesirable in peek_fifo, and
it is undesirable in a nonblocking read.  Fix this by adding a timeout
parameter to take_ownership.

Arbitrarily use a 1 ms timeout in peek_fifo and a 10 ms timeout in
raw_read.  These numbers may have to be tweaked based on experience.

Replace the call to cygwait in take_ownership by a call to WFSO.
There's no need to allow interruption now that we have a timeout.
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_fifo.cc
winsup/cygwin/select.cc
This page took 0.028344 seconds and 5 git commands to generate.