Commit af0f3260 authored by Joe Drago's avatar Joe Drago
Browse files

Rename CPU count helper function, document its failure case

No related merge requests found
Showing with 8 additions and 8 deletions
+8 -8
......@@ -75,7 +75,7 @@ int main(int argc, char * argv[])
} else if (!strcmp(arg, "-j") || !strcmp(arg, "--jobs")) {
NEXTARG();
if (!strcmp(arg, "all")) {
jobs = avifQueryMaxThreads();
jobs = avifQueryCPUCount();
} else {
jobs = atoi(arg);
if (jobs < 1) {
......
......@@ -488,7 +488,7 @@ int main(int argc, char * argv[])
} else if (!strcmp(arg, "-j") || !strcmp(arg, "--jobs")) {
NEXTARG();
if (!strcmp(arg, "all")) {
jobs = avifQueryMaxThreads();
jobs = avifQueryCPUCount();
} else {
jobs = atoi(arg);
if (jobs < 1) {
......
......@@ -222,7 +222,7 @@ void avifDumpDiagnostics(const avifDiagnostics * diag)
}
// ---------------------------------------------------------------------------
// avifQueryMaxThreads (separated into OS implementations)
// avifQueryCPUCount (separated into OS implementations)
#if defined(_WIN32)
......@@ -232,7 +232,7 @@ void avifDumpDiagnostics(const avifDiagnostics * diag)
#pragma warning(disable : 5032)
#include <windows.h>
int avifQueryMaxThreads(void)
int avifQueryCPUCount(void)
{
int numCPU;
SYSTEM_INFO sysinfo;
......@@ -247,7 +247,7 @@ int avifQueryMaxThreads(void)
#include <sys/sysctl.h>
int avifQueryMaxThreads()
int avifQueryCPUCount()
{
int mib[4];
int numCPU;
......@@ -273,7 +273,7 @@ int avifQueryMaxThreads()
// Emscripten
int avifQueryMaxThreads()
int avifQueryCPUCount()
{
return 1;
}
......@@ -284,7 +284,7 @@ int avifQueryMaxThreads()
#include <unistd.h>
int avifQueryMaxThreads()
int avifQueryCPUCount()
{
int numCPU = (int)sysconf(_SC_NPROCESSORS_ONLN);
return (numCPU > 0) ? numCPU : 1;
......
......@@ -24,7 +24,7 @@ void avifImageDump(avifImage * avif, uint32_t gridCols, uint32_t gridRows);
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
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment