System: fix Windows process pipe busy loop
A synchronous zero-byte pipe read was stored as ready data, leaving communicate_blocking with nothing to wait on and no progress (a spin). Treat a zero-byte read as EOF in both the issue and completion paths. Make the stdout/stderr independence test use cmd.exe syntax on Windows. Wine 11, x86_64-w64-mingw32 GCC 16.2: full VoidTests.exe suite passes (1337 tests, 1323 passed, 14 skipped, 0 failed). Refs #65
This commit is contained in:
1 parent
3939b05396
commit
796609787e
2 files changed
+19
-2
No files matched your search
@@ -627,7 +627,16 @@ namespace
|
||||
&got,
|
||||
&stream.ov) != 0)
|
||||
{
|
||||
stream.read_ready = got;
|
||||
// A zero-byte success is EOF; storing it as "ready" data would
|
||||
// leave the caller with nothing to wait on (busy loop).
|
||||
if (got == 0)
|
||||
{
|
||||
stream.eof = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream.read_ready = got;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const DWORD error = ::GetLastError();
|
||||
@@ -688,8 +697,12 @@ namespace
|
||||
got = stream.read_ready;
|
||||
stream.read_ready = 0;
|
||||
}
|
||||
if (got == 0)
|
||||
{
|
||||
return IoStatus::eof;
|
||||
}
|
||||
bytes = got;
|
||||
return got > 0 ? IoStatus::data : IoStatus::none;
|
||||
return IoStatus::data;
|
||||
}
|
||||
|
||||
void issue_write(WinStream& stream,
|
||||
|
||||
Reference in new issue
Block a user