Fix infinite loop with --hide-kernel-threads option