Rename CPU count helper function, document its failure case
diff --git a/apps/avifdec.c b/apps/avifdec.c index 81de197..81df2cb 100644 --- a/apps/avifdec.c +++ b/apps/avifdec.c
@@ -75,7 +75,7 @@ } else if (!strcmp(arg, "-j") || !strcmp(arg, "--jobs")) { NEXTARG(); if (!strcmp(arg, "all")) { - jobs = avifQueryMaxThreads(); + jobs = avifQueryCPUCount(); } else { jobs = atoi(arg); if (jobs < 1) {
diff --git a/apps/avifenc.c b/apps/avifenc.c index 4415bf8..0ca8ff4 100644 --- a/apps/avifenc.c +++ b/apps/avifenc.c
@@ -488,7 +488,7 @@ } else if (!strcmp(arg, "-j") || !strcmp(arg, "--jobs")) { NEXTARG(); if (!strcmp(arg, "all")) { - jobs = avifQueryMaxThreads(); + jobs = avifQueryCPUCount(); } else { jobs = atoi(arg); if (jobs < 1) {
diff --git a/apps/shared/avifutil.c b/apps/shared/avifutil.c index 4ddc406..5ae7553 100644 --- a/apps/shared/avifutil.c +++ b/apps/shared/avifutil.c
@@ -222,7 +222,7 @@ } // --------------------------------------------------------------------------- -// avifQueryMaxThreads (separated into OS implementations) +// avifQueryCPUCount (separated into OS implementations) #if defined(_WIN32) @@ -232,7 +232,7 @@ #pragma warning(disable : 5032) #include <windows.h> -int avifQueryMaxThreads(void) +int avifQueryCPUCount(void) { int numCPU; SYSTEM_INFO sysinfo; @@ -247,7 +247,7 @@ #include <sys/sysctl.h> -int avifQueryMaxThreads() +int avifQueryCPUCount() { int mib[4]; int numCPU; @@ -273,7 +273,7 @@ // Emscripten -int avifQueryMaxThreads() +int avifQueryCPUCount() { return 1; } @@ -284,7 +284,7 @@ #include <unistd.h> -int avifQueryMaxThreads() +int avifQueryCPUCount() { int numCPU = (int)sysconf(_SC_NPROCESSORS_ONLN); return (numCPU > 0) ? numCPU : 1;
diff --git a/apps/shared/avifutil.h b/apps/shared/avifutil.h index 2921cf6..3ea3801 100644 --- a/apps/shared/avifutil.h +++ b/apps/shared/avifutil.h
@@ -24,7 +24,7 @@ void avifContainerDump(avifDecoder * decoder); void avifPrintVersions(void); void avifDumpDiagnostics(const avifDiagnostics * diag); -int avifQueryMaxThreads(void); +int avifQueryCPUCount(void); // Returns 1 if it cannot query or fails to query typedef enum avifAppFileFormat {