limit the number of active threads