class documentation
class DaemonThreadPoolExecutor(ThreadPoolExecutor): (source)
Constructor: DaemonThreadPoolExecutor(max_workers, thread_name_prefix)
Run functions in a bounded set of daemon threads.
asyncio requires a ThreadPoolExecutor as its default
executor. This class provides that interface and creates daemon workers
lazily as work is submitted, up to the configured maximum.
| Method | __enter__ |
Return this executor for use as a context manager. |
| Method | __exit__ |
Stop the executor when its context exits. |
| Method | __init__ |
Initialize the executor without eagerly starting workers. |
| Method | owns |
Return whether this executor owns thread. |
| Method | shutdown |
Stop the executor. |
| Method | submit |
Submit a function call to the worker queue. |
| Method | _worker |
Run queued work until the queue contains a stop marker. |
| Instance Variable | _shutdown |
Undocumented |
| Instance Variable | _threads |
Undocumented |
| Instance Variable | _work |
Undocumented |
def __exit__(self, exc_type:
type[ BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None):
(source)
¶
Stop the executor when its context exits.
Initialize the executor without eagerly starting workers.
| Parameters | |
maxint | Number of worker threads. |
threadstr | Prefix for each worker thread name. |
| Raises | |
ValueError | If max_workers is not positive. |