Adding global variable for the max number of threads to create