summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsjtxietian <jsjtxietian@outlook.com>2023-11-15 12:13:33 +0800
committerjsjtxietian <jsjtxietian@outlook.com>2024-02-21 19:16:45 +0800
commit492785b792e581e8714c54c3116327b94c09705e (patch)
tree4248756ed3f21dd6f154f0191694a51f994ecb98
parentae51db75e7a4b4d111cf5dcbf596bc2c8c8a3222 (diff)
downloadredot-engine-492785b792e581e8714c54c3116327b94c09705e.tar.gz
Update WorkerThreadPool doc to mention every task should be waited
at some point so that any allocated resources can be cleaned up.
-rw-r--r--doc/classes/WorkerThreadPool.xml4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/classes/WorkerThreadPool.xml b/doc/classes/WorkerThreadPool.xml
index fa1f08b149..2b1bc136cb 100644
--- a/doc/classes/WorkerThreadPool.xml
+++ b/doc/classes/WorkerThreadPool.xml
@@ -58,6 +58,7 @@
Adds [param action] as a group task to be executed by the worker threads. The [Callable] will be called a number of times based on [param elements], with the first thread calling it with the value [code]0[/code] as a parameter, and each consecutive execution incrementing this value by 1 until it reaches [code]element - 1[/code].
The number of threads the task is distributed to is defined by [param tasks_needed], where the default value [code]-1[/code] means it is distributed to all worker threads. [param high_priority] determines if the task has a high priority or a low priority (default). You can optionally provide a [param description] to help with debugging.
Returns a group task ID that can be used by other methods.
+ [b]Warning:[/b] Every task must be waited for completion using [method wait_for_task_completion] or [method wait_for_group_task_completion] at some point so that any allocated resources inside the task can be cleaned up.
</description>
</method>
<method name="add_task">
@@ -68,6 +69,7 @@
<description>
Adds [param action] as a task to be executed by a worker thread. [param high_priority] determines if the task has a high priority or a low priority (default). You can optionally provide a [param description] to help with debugging.
Returns a task ID that can be used by other methods.
+ [b]Warning:[/b] Every task must be waited for completion using [method wait_for_task_completion] or [method wait_for_group_task_completion] at some point so that any allocated resources inside the task can be cleaned up.
</description>
</method>
<method name="get_group_processed_element_count" qualifiers="const">
@@ -83,6 +85,7 @@
<param index="0" name="group_id" type="int" />
<description>
Returns [code]true[/code] if the group task with the given ID is completed.
+ [b]Note:[/b] You should only call this method between adding the group task and awaiting its completion.
</description>
</method>
<method name="is_task_completed" qualifiers="const">
@@ -90,6 +93,7 @@
<param index="0" name="task_id" type="int" />
<description>
Returns [code]true[/code] if the task with the given ID is completed.
+ [b]Note:[/b] You should only call this method between adding the task and awaiting its completion.
</description>
</method>
<method name="wait_for_group_task_completion">