Remove the use of PTHREAD_THREADS_MAX in hsmspeed and add a own define. Also check the threads specified on command line so we do not walk outside the array and segfault.