Getting pthreads parameterized by the desired number of threads