Cygwin: FIFO: make opening a writer more robust

- Make read_ready a manual-reset event.

- Signal read_ready in open instead of in the listen_client_thread.

- Don't reset read_ready when the listen_client thread terminates;
  instead do it in close().

- Rearrange open and change its error handling.

- Add a wait_open_pipe method that waits for a pipe instance to be
  available and then calls open_pipe.  Use it when opening a writer if
  we can't connect immediately.  This can happen if the system is
  heavily loaded and/or if many writers are trying to open
  simultaneously.
This commit is contained in:
Ken Brown
2020-03-17 14:14:47 -04:00
parent 301454f132
commit 9ee8fdf2b3
2 changed files with 170 additions and 102 deletions

View File

@@ -1323,6 +1323,7 @@ class fhandler_fifo: public fhandler_base
static NTSTATUS npfs_handle (HANDLE &);
HANDLE create_pipe_instance (bool);
NTSTATUS open_pipe (HANDLE&);
NTSTATUS wait_open_pipe (HANDLE&);
int add_client_handler ();
void delete_client_handler (int);
bool listen_client ();