Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for setting unlimited max_threads from environment
Extending PR #4931. Aside of just setting `$!max_threads` to a specific number via `RAKUDO_MAX_THREADS` environment variable the following special cases are now supported too: - `RAKUDO_MAX_THREADS=` or `RAKUDO_MAX_THREADS=0` to use the default value - `RAKUDO_MAX_THREADS=-1`, `RAKUDO_MAX_THREADS=inf`, or `RAKUDO_MAX_THREADS=unlimited` to use unlimited number of treads - `RAKUDO_MAX_THREADS=<integer>` works as it always was - Any other value would result in an error Since a new scheduler is normally created at startup and exception handling is barely needed its constructor currently throws just `X::AdHoc`. Note that the above special cases are now also supported for constructor's `:max_threads` named argument: ThreadPoolScheduler.new(:max_threads(-1)); # Inf ThreadPoolScheduler.new(:max_threads<unlimited>); # Inf ThreadPoolScheduler.new(:max_threads(0)); # Same as omitting the # argument Super-micro-optimization: use of BUILDPLAN is considered too much for the `ThreadPoolScheduler` class. So, replaced it with `new`+`!SET-SELF` approach.
- Loading branch information