SharedTaskPool#
Added in version 1.20.
Superclasses: TaskPool
, Object
, InitiallyUnowned
, Object
The SharedTaskPool
object.
Constructors#
- class SharedTaskPool
- classmethod new() → TaskPool#
Create a new shared task pool. The shared task pool will queue tasks on a maximum number of threads, 1 by default.
Do not use a
SharedTaskPool
to manage potentially inter-dependent tasks such as pad tasks, as having one task waiting on another to return before returning would cause obvious deadlocks if they happen to share the same thread.Added in version 1.20.
Methods#
- class SharedTaskPool
-
- set_max_threads(max_threads: int) → None#
Update the maximal number of threads the
pool
may spawn. When the maximal number of threads is reduced, existing threads are not immediately shut down, seeset_max_threads()
.Setting
max_threads
to 0 effectively freezes the pool.Added in version 1.20.
- Parameters:
max_threads – Maximum number of threads to spawn.