.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_Thread: Thread ====== **Inherits:** :ref:`Reference` **<** :ref:`Object` **Category:** Core Brief Description ----------------- A unit of execution in a process. Member Functions ---------------- +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_id` **(** **)** const | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_active` **(** **)** const | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`start` **(** :ref:`Object` instance, :ref:`String` method, :ref:`Variant` userdata=null, :ref:`int` priority=null **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`wait_to_finish` **(** **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Numeric Constants ----------------- - **PRIORITY_LOW** = **0** - **PRIORITY_NORMAL** = **1** - **PRIORITY_HIGH** = **2** Description ----------- A unit of execution in a process. Can run methods on :ref:`Object`\ s simultaneously. The use of synchronization via :ref:`Mutex`, :ref:`Semaphore` is advised if working with shared objects. Member Function Description --------------------------- .. _class_Thread_get_id: - :ref:`String` **get_id** **(** **)** const Return the id of the thread, uniquely identifying it among all threads. .. _class_Thread_is_active: - :ref:`bool` **is_active** **(** **)** const Whether 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_start: - :ref:`int` **start** **(** :ref:`Object` instance, :ref:`String` method, :ref:`Variant` userdata=null, :ref:`int` priority=null **)** Start a new :ref:`Thread`, it will run "method" on object "instance" using "userdata" as an argument and running with "priority", one of PRIORITY\_\* enum. Returns OK on success, or ERR_CANT_CREATE on failure. .. _class_Thread_wait_to_finish: - :ref:`Variant` **wait_to_finish** **(** **)** Joins the :ref:`Thread` and waits for it to finish. Returns what the method called returned.