Cygwin: FIFO: allow take_ownership to be interrupted

Use cygwait in take_ownership to allow interruption while waiting to
become owner.  Return the cygwait return value or a suitable value to
indicate an error.

raw_read now checks the return value and acts accordingly.
This commit is contained in:
Ken Brown
2020-07-13 07:01:57 -04:00
parent a4dc0eb15c
commit 4eaa55463d
3 changed files with 59 additions and 8 deletions

View File

@ -867,7 +867,16 @@ peek_fifo (select_record *s, bool from_select)
}
fh->reading_lock ();
fh->take_ownership ();
if (fh->take_ownership () != WAIT_OBJECT_0)
{
select_printf ("%s, unable to take ownership", fh->get_name ());
fh->reading_unlock ();
gotone += s->read_ready = true;
if (s->except_selected)
gotone += s->except_ready = true;
goto out;
}
fh->fifo_client_lock ();
int nconnected = 0;
for (int i = 0; i < fh->get_nhandlers (); i++)