Add a check for environmental variable TIPPECANOE_MAX_THREADS

This commit is contained in:
Eric Fischer
2017-02-17 16:47:21 -08:00
parent 9c1f2b2123
commit 55e7e20a73
3 changed files with 18 additions and 1 deletions
+8 -1
View File
@@ -117,7 +117,14 @@ void checkdisk(struct reader *r, int nreader) {
};
void init_cpus() {
CPUS = sysconf(_SC_NPROCESSORS_ONLN);
const char *TIPPECANOE_MAX_THREADS = getenv("TIPPECANOE_MAX_THREADS");
if (TIPPECANOE_MAX_THREADS != NULL) {
CPUS = atoi(TIPPECANOE_MAX_THREADS);
} else {
CPUS = sysconf(_SC_NPROCESSORS_ONLN);
}
if (CPUS < 1) {
CPUS = 1;
}