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.
This commit is contained in:
@ -1487,7 +1487,7 @@ public:
|
||||
void fifo_client_lock () { _fifo_client_lock.lock (); }
|
||||
void fifo_client_unlock () { _fifo_client_lock.unlock (); }
|
||||
|
||||
DWORD take_ownership ();
|
||||
int take_ownership (DWORD timeout = INFINITE);
|
||||
void reading_lock () { shmem->reading_lock (); }
|
||||
void reading_unlock () { shmem->reading_unlock (); }
|
||||
|
||||
|
Reference in New Issue
Block a user