aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2021-01-24 19:22:35 +0200
committerLasse Collin <lasse.collin@tukaani.org>2021-01-24 19:22:35 +0200
commit6b8abc84a5469792e0355d0bfc0784d41cfdfef7 (patch)
tree137b2a7bcbda2d97d6c2a23ed0573389b1bbba76
parentTests: Add bad-1-lzma2-9.xz. (diff)
downloadxz-6b8abc84a5469792e0355d0bfc0784d41cfdfef7.tar.xz
liblzma: Fix a wrong comment in stream_encoder_mt.c.
-rw-r--r--src/liblzma/common/stream_encoder_mt.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/liblzma/common/stream_encoder_mt.c b/src/liblzma/common/stream_encoder_mt.c
index 6b897ab9..91cda998 100644
--- a/src/liblzma/common/stream_encoder_mt.c
+++ b/src/liblzma/common/stream_encoder_mt.c
@@ -640,9 +640,13 @@ wait_for_work(lzma_stream_coder *coder, mythread_condtime *wait_abs,
// to true here and calculate the absolute time when
// we must return if there's nothing to do.
//
- // The idea of *has_blocked is to avoid unneeded calls
- // to mythread_condtime_set(), which may do a syscall
- // depending on the operating system.
+ // This way if we block multiple times for short moments
+ // less than "timeout" milliseconds, we will return once
+ // "timeout" amount of time has passed since the *first*
+ // blocking occurred. If the absolute time was calculated
+ // again every time we block, "timeout" would effectively
+ // be meaningless if we never consecutively block longer
+ // than "timeout" ms.
*has_blocked = true;
mythread_condtime_set(wait_abs, &coder->cond, coder->timeout);
}