Cygwin: FIFO: hit_eof: add a call to fifo_client_lock
The second check of nconnected needs to be protected by a lock as well as the first.
This commit is contained in:
parent
b63843ed56
commit
5281699926
|
@ -705,15 +705,20 @@ fhandler_fifo::raw_write (const void *ptr, size_t len)
|
||||||
bool
|
bool
|
||||||
fhandler_fifo::hit_eof ()
|
fhandler_fifo::hit_eof ()
|
||||||
{
|
{
|
||||||
fifo_client_lock ();
|
bool eof;
|
||||||
bool eof = (nconnected == 0);
|
bool retry = true;
|
||||||
fifo_client_unlock ();
|
|
||||||
if (eof)
|
retry:
|
||||||
{
|
fifo_client_lock ();
|
||||||
/* Give the listen_client thread time to catch up, then recheck. */
|
|
||||||
Sleep (1);
|
|
||||||
eof = (nconnected == 0);
|
eof = (nconnected == 0);
|
||||||
}
|
fifo_client_unlock ();
|
||||||
|
if (eof && retry)
|
||||||
|
{
|
||||||
|
retry = false;
|
||||||
|
/* Give the listen_client thread time to catch up. */
|
||||||
|
Sleep (1);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
return eof;
|
return eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue