> if (num_threads <= 1) {
... do single-threaded version ...
> } else {
... do multi-threaded version ...
> } > That matches the logic in builtin/pack-objects.c.
Maybe use the simplest version (and keep num_numbers == 0 also as flag for all other checks in code like if(num_flags) .... ):
if (list.nr || cached )
num_threads = 0; // do not use threads
else if (num_threads == 0)
num_threads = online_cpus() <= 1 ? 0 : GREP_NUM_THREADS_DEFAULT;
else if (num_threads < 0)
die(...)
// here we are num_threads > zero, so do nothing