aboutsummaryrefslogtreecommitdiff
path: root/src/xz/file_io.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2020-01-26 14:13:42 +0200
committerLasse Collin <lasse.collin@tukaani.org>2020-01-26 14:13:42 +0200
commit5a49e081a098455bcdbd95cefb90e9b18780fe58 (patch)
tree323ddab03fabed2e00828eaaed8a29598eb06887 /src/xz/file_io.h
parentxz: Refactor io_read() a bit. (diff)
downloadxz-5a49e081a098455bcdbd95cefb90e9b18780fe58.tar.xz
xz: Fix semi-busy-waiting in xz --flush-timeout.
When input blocked, xz --flush-timeout=1 would wake up every millisecond and initiate flushing which would have nothing to flush and thus would just waste CPU time. The fix disables the timeout when no input has been seen since the previous flush.
Diffstat (limited to '')
-rw-r--r--src/xz/file_io.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/xz/file_io.h b/src/xz/file_io.h
index 4b4418d6..5da2c90a 100644
--- a/src/xz/file_io.h
+++ b/src/xz/file_io.h
@@ -49,6 +49,10 @@ typedef struct {
/// True once end of the source file has been detected.
bool src_eof;
+ /// For --flush-timeout: True if at least one byte has been read
+ /// since the previous flush or the start of the file.
+ bool src_has_seen_input;
+
/// If true, we look for long chunks of zeros and try to create
/// a sparse file.
bool dest_try_sparse;