Helpers to limit the number of threads used
