mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
79 lines
4.0 KiB
ReStructuredText
79 lines
4.0 KiB
ReStructuredText
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the Thread.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_Thread:
|
|
|
|
Thread
|
|
======
|
|
|
|
**Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
|
|
|
|
**Category:** Core
|
|
|
|
Brief Description
|
|
-----------------
|
|
|
|
A unit of execution in a process.
|
|
|
|
Member Functions
|
|
----------------
|
|
|
|
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_string>` | :ref:`get_id<class_Thread_get_id>` **(** **)** const |
|
|
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_active<class_Thread_is_active>` **(** **)** const |
|
|
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`start<class_Thread_start>` **(** :ref:`Object<class_object>` instance, :ref:`String<class_string>` method, :ref:`Variant<class_variant>` userdata=null, :ref:`int<class_int>` priority=1 **)** |
|
|
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Variant<class_variant>` | :ref:`wait_to_finish<class_Thread_wait_to_finish>` **(** **)** |
|
|
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Enums
|
|
-----
|
|
|
|
.. _enum_Thread_Priority:
|
|
|
|
enum **Priority**
|
|
|
|
- **PRIORITY_LOW** = **0**
|
|
- **PRIORITY_NORMAL** = **1**
|
|
- **PRIORITY_HIGH** = **2**
|
|
|
|
|
|
Description
|
|
-----------
|
|
|
|
A unit of execution in a process. Can run methods on :ref:`Object<class_object>`\ s simultaneously. The use of synchronization via :ref:`Mutex<class_mutex>`, :ref:`Semaphore<class_semaphore>` is advised if working with shared objects.
|
|
|
|
Member Function Description
|
|
---------------------------
|
|
|
|
.. _class_Thread_get_id:
|
|
|
|
- :ref:`String<class_string>` **get_id** **(** **)** const
|
|
|
|
Returns the current ``Thread``\ s id, uniquely identifying it among all threads.
|
|
|
|
.. _class_Thread_is_active:
|
|
|
|
- :ref:`bool<class_bool>` **is_active** **(** **)** const
|
|
|
|
Returns true if this ``Thread`` is currently active. An active ``Thread`` cannot start work on a new method but can be joined with :ref:`wait_to_finish<class_Thread_wait_to_finish>`.
|
|
|
|
.. _class_Thread_start:
|
|
|
|
- :ref:`int<class_int>` **start** **(** :ref:`Object<class_object>` instance, :ref:`String<class_string>` method, :ref:`Variant<class_variant>` userdata=null, :ref:`int<class_int>` priority=1 **)**
|
|
|
|
Starts a new ``Thread`` that runs "method" on object "instance" with "userdata" passed as an argument. The "priority" of the ``Thread`` can be changed by passing a PRIORITY\_\* enum.
|
|
|
|
Returns OK on success, or ERR_CANT_CREATE on failure.
|
|
|
|
.. _class_Thread_wait_to_finish:
|
|
|
|
- :ref:`Variant<class_variant>` **wait_to_finish** **(** **)**
|
|
|
|
Joins the ``Thread`` and waits for it to finish. Returns what the method called returned.
|
|
|
|
|