class documentation

class ThreadManager:

Constructor: ThreadManager()

View In Hierarchy

Class to manage multiple threads.

Method __init__ Initialize the thread manager.
Method add_task Add a task to the manager.
Method remove_task Stop and remove a queued task by ID.
Method run Run tasks one-by-one, waiting for each to complete before starting the next.
Class Variable __slots__ Undocumented
Property is_idle Return whether no task is queued or active.
Property pending_count Return the number of queued tasks, excluding the active task.
Property task Get the currently active task.
Property thread Get the currently active thread.
Instance Variable _active_task Undocumented
Instance Variable _active_thread Undocumented
Instance Variable _id Undocumented
Instance Variable _outgoing Undocumented
Instance Variable _tasks Undocumented
def __init__(self):

Initialize the thread manager.

def add_task(self, task: ThreadTask) -> int:

Add a task to the manager.

Parameters
task:ThreadTaskThe task to add.
Returns
intThe assigned task ID.
def remove_task(self, task_id: int) -> bool:

Stop and remove a queued task by ID.

Parameters
task_id:intThe ID of the task to remove.
Returns
boolTrue if the task was removed, False otherwise.
def run(self) -> str:

Run tasks one-by-one, waiting for each to complete before starting the next.

Returns
strAny output messages from finished or failed tasks.
__slots__: tuple[str, ...] =

Undocumented

@property
is_idle: bool =

Return whether no task is queued or active.

@property
pending_count: int =

Return the number of queued tasks, excluding the active task.

@property
task: ThreadTask =

Get the currently active task.

@property
thread: Thread =

Get the currently active thread.

_active_task: ThreadTask =

Undocumented

_active_thread: Thread =

Undocumented

_id: int =

Undocumented

_outgoing =

Undocumented

_tasks: list[ThreadTask] =

Undocumented