@@ -822,15 +822,6 @@ static unsigned init_nbWorkers(void) {
822
822
CLEAN_RETURN(1); \
823
823
} } }
824
824
825
- #define NEXT_INT32 (_vari32 ) { \
826
- const char* __nb; \
827
- NEXT_FIELD(__nb); \
828
- _vari32 = (int)readU32FromChar(&__nb); \
829
- if(*__nb != 0) { \
830
- errorOut("error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed"); \
831
- } \
832
- }
833
-
834
825
#define NEXT_UINT32 (_varu32 ) { \
835
826
const char* __nb; \
836
827
NEXT_FIELD(__nb); \
@@ -887,7 +878,8 @@ int main(int argCount, const char* argv[])
887
878
removeSrcFile = 0 ,
888
879
cLevel = init_cLevel (),
889
880
ultra = 0 ,
890
- cLevelLast = MINCLEVEL - 1 ; /* for benchmark range */
881
+ cLevelLast = MINCLEVEL - 1 , /* for benchmark range */
882
+ setThreads_non1 = 0 ;
891
883
unsigned nbWorkers = init_nbWorkers ();
892
884
ZSTD_ParamSwitch_e mmapDict = ZSTD_ps_auto ;
893
885
ZSTD_ParamSwitch_e useRowMatchFinder = ZSTD_ps_auto ;
@@ -1090,7 +1082,7 @@ int main(int argCount, const char* argv[])
1090
1082
continue ;
1091
1083
}
1092
1084
#endif
1093
- if (longCommandWArg (& argument , "--threads" )) { NEXT_UINT32 (nbWorkers ); continue ; }
1085
+ if (longCommandWArg (& argument , "--threads" )) { NEXT_UINT32 (nbWorkers ); setThreads_non1 = ( nbWorkers != 1 ); continue ; }
1094
1086
if (longCommandWArg (& argument , "--memlimit" )) { NEXT_UINT32 (memLimit ); continue ; }
1095
1087
if (longCommandWArg (& argument , "--memory" )) { NEXT_UINT32 (memLimit ); continue ; }
1096
1088
if (longCommandWArg (& argument , "--memlimit-decompress" )) { NEXT_UINT32 (memLimit ); continue ; }
@@ -1297,6 +1289,7 @@ int main(int argCount, const char* argv[])
1297
1289
case 'T' :
1298
1290
argument ++ ;
1299
1291
nbWorkers = readU32FromChar (& argument );
1292
+ setThreads_non1 = (nbWorkers != 1 );
1300
1293
break ;
1301
1294
1302
1295
/* Dictionary Selection level */
@@ -1341,6 +1334,9 @@ int main(int argCount, const char* argv[])
1341
1334
DISPLAYLEVEL (3 , WELCOME_MESSAGE );
1342
1335
1343
1336
#ifdef ZSTD_MULTITHREAD
1337
+ if ((operation == zom_decompress ) && (setThreads_non1 )) {
1338
+ DISPLAYLEVEL (2 , "Warning : decompression does not support multi-threading\n" );
1339
+ }
1344
1340
if ((nbWorkers == NBWORKERS_AUTOCPU ) && (!singleThread )) {
1345
1341
/* automatically set # workers based on # of reported cpu cores */
1346
1342
if (defaultLogicalCores ) {
@@ -1354,7 +1350,7 @@ int main(int argCount, const char* argv[])
1354
1350
if (operation == zom_compress )
1355
1351
DISPLAYLEVEL (4 , "Compressing with %u worker threads \n" , nbWorkers );
1356
1352
#else
1357
- (void )singleThread ; (void )nbWorkers ; (void )defaultLogicalCores ;
1353
+ (void )singleThread ; (void )nbWorkers ; (void )defaultLogicalCores ; ( void ) setThreads_non1 ;
1358
1354
#endif
1359
1355
1360
1356
g_utilDisplayLevel = g_displayLevel ;
0 commit comments