]> sourceware.org Git - newlib-cygwin.git/commit
Cygwin: FIFO: synchronize the fifo_reader and fifosel threads
authorKen Brown <kbrown@cornell.edu>
Mon, 3 Aug 2020 13:38:08 +0000 (09:38 -0400)
committerKen Brown <kbrown@cornell.edu>
Tue, 4 Aug 2020 12:15:19 +0000 (08:15 -0400)
commit0fda55133a82eb70e98e636d0d00f48c674b9440
tree3d4d375f079b9c3fd94cb376f8e8c0601d7d698a
parent251624a3529c3d0d3d9cdb5fbaf4c3e9b079c894
Cygwin: FIFO: synchronize the fifo_reader and fifosel threads

The fifo_reader thread function and the function select.cc:peek_fifo()
can both change the state of a fifo_client_handler.  These changes are
made under fifo_client_lock, so there is no race, but the changes can
still be incompatible.

Add code to make sure that only one of these functions can change the
state from its initial fc_listening state.  Whichever function does
this calls the fhandler_fifo::record_connection method, which is now
public so that peek_fifo can call it.

Slightly modify that method to make it suitable for being called by
peek_fifo.

Make a few other small changes to the fifo_reader thread function to
change how it deals with the STATUS_PIPE_CLOSING value that can
(rarely) be returned by NtFsControlFile.

Add commentary to fhandler_fifo.cc to explain fifo_client connect
states and where they can be changed.
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_fifo.cc
winsup/cygwin/select.cc
This page took 0.029988 seconds and 5 git commands to generate.