Add warning when multi-thread decompression is requested (#3208)

When user pass in argument for both decompression and multi-thread, print a warning message
to indicate that multi-threaded decompression is not supported.

* Add warning when multi-thread decompression is requested
* add test case for multi-threaded decoding warning
   Expectation is for -d -T0 we will not throw any warning,
   and see warning for any other -d -T(>1) inputs
This commit is contained in:
Tom Wang 2022-07-29 12:51:58 -07:00 committed by GitHub
parent 2b9fde932b
commit d4a5bc4efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -1226,6 +1226,9 @@ int main(int argCount, const char* argv[])
DISPLAYLEVEL(3, WELCOME_MESSAGE);
#ifdef ZSTD_MULTITHREAD
if ((operation==zom_decompress) && (!singleThread) && (nbWorkers > 1)) {
DISPLAYLEVEL(2, "Warning : decompression does not support multi-threading\n");
}
if ((nbWorkers==0) && (!singleThread)) {
/* automatically set # workers based on # of reported cpus */
if (defaultLogicalCores) {

View File

@ -9,3 +9,7 @@ zstd --rsyncable -f file ; zstd -t file.zst
zstd -T0 -f file ; zstd -t file.zst
zstd -T0 --auto-threads=logical -f file ; zstd -t file.zst
zstd -T0 --auto-threads=physical -f file; zstd -t file.zst
# multi-thread decompression warning test
zstd -T0 -f file ; zstd -t file.zst; zstd -T0 -d file.zst -o file3
zstd -T0 -f file ; zstd -t file.zst; zstd -T2 -d file.zst -o file4

View File

@ -0,0 +1 @@
Warning : decompression does not support multi-threading