cleverly.learners.thread_limit#
- cleverly.learners.thread_limit(limit: int | None = -1) Iterator[None][source]#
Limit native thread pools for the duration of the block.
- Parameters:
- Yields:
NoneThe block runs with the limit applied, and the previous limit is restored on exit.
Notes
The controller doing the limiting is process-wide and built once. See the module docstring for why, for what refcounting the blocks buys when two of them overlap, and
refresh_thread_pools()for when the cache has to be discarded.