adaptable number threads