Add a method to restrict the threads allowed in the critical path.