Cygwin: FIFO: reorganize some fifo_client_handler methods

Rename the existing set_state() to query_and_set_state() to reflect
what it really does.  (It queries the O/S for the pipe state.)  Add a
new set_state() method, which is a standard setter, and a
corresponding getter get_state().
This commit is contained in:
Ken Brown
2020-08-03 09:32:30 -04:00
parent 6ed067a0ae
commit 289af73a89
3 changed files with 50 additions and 37 deletions

View File

@ -1297,11 +1297,14 @@ enum fifo_client_connect_state
struct fifo_client_handler
{
HANDLE h;
fifo_client_connect_state state;
fifo_client_connect_state _state;
bool last_read; /* true if our last successful read was from this client. */
fifo_client_handler () : h (NULL), state (fc_unknown), last_read (false) {}
fifo_client_handler () : h (NULL), _state (fc_unknown), last_read (false) {}
void close () { NtClose (h); }
fifo_client_connect_state set_state ();
fifo_client_connect_state get_state () const { return _state; }
void set_state (fifo_client_connect_state s) { _state = s; }
/* Query O/S. Return previous state. */
fifo_client_connect_state query_and_set_state ();
};
class fhandler_fifo;