pub fn with_max_threads<R>(n: usize, f: impl FnOnce() -> R) -> RExpand description
Run f with the thread limit set to n on this thread only (0 = no override).
set_max_threads is process-wide, which is right for a command-line tool and
wrong for a library host running several solves at once with different
budgets. Every stage reads the limit on the thread that called the solver, and
the solvers that hand work to their own threads pass the override on, so a
solve inside f keeps to n threads whatever the rest of the process does.
The previous value is restored when f returns or unwinds.