]> git.ipfire.org Git - thirdparty/zstd.git/commit
ZSTDMT_compressStream() becomes blocking when required to ensure forward progresses
authorYann Collet <cyan@fb.com>
Mon, 23 Jan 2017 07:49:52 +0000 (23:49 -0800)
committerYann Collet <cyan@fb.com>
Mon, 23 Jan 2017 07:49:52 +0000 (23:49 -0800)
commit1a2547f6540c8f208fe116072cd935960acfe62a
tree01a5d111cd5689cc29aee532d962e8a8bf3051e3
parentc5933487227fcd9262d84efd2a0a4e5432b0c41c
ZSTDMT_compressStream() becomes blocking when required to ensure forward progresses

In some (rare) cases, job list could be blocked by a first job still being processed,
while all following ones are completed, waiting to be flushed.
In such case, the current job-table implementation is unable to accept new job.
As a consequence, a call to ZSTDMT_compressStream() can be useless (nothing read, nothing flushed),
with the risk to trigger a busy-wait on the caller side
(needlessly loop over ZSTDMT_compressStream() ).

In such a case, ZSTDMT_compressStream() will block until the first job is completed and ready to flush.
It ensures some forward progress by guaranteeing it will flush at least a part of the completed job.
Energy-wasting busy-wait is avoided.
lib/compress/zstdmt_compress.c