Allow customize the number of threads.