diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2020-01-26 14:13:42 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2020-01-26 14:13:42 +0200 |
commit | 5a49e081a098455bcdbd95cefb90e9b18780fe58 (patch) | |
tree | 323ddab03fabed2e00828eaaed8a29598eb06887 /src/xz/coder.c | |
parent | xz: Refactor io_read() a bit. (diff) | |
download | xz-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/coder.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c index 1cd03857..3f561851 100644 --- a/src/xz/coder.c +++ b/src/xz/coder.c @@ -729,6 +729,10 @@ coder_normal(file_pair *pair) // Set the time of the most recent flushing. mytime_set_flush_time(); + + // Mark that we haven't seen any new input + // since the previous flush. + pair->src_has_seen_input = false; } else { // Start a new Block after LZMA_FULL_BARRIER. if (opt_block_list == NULL) { |