Fix building threading for freebsd

FreeBSD (and at least NetBSD as well) still use hw.ncpu without
deprecating it, contrary to apple.