thread-utils.c: detect CPU count on older BSD-like systems