mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
57 lines
1.7 KiB
ReStructuredText
57 lines
1.7 KiB
ReStructuredText
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the Mutex.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_Mutex:
|
|
|
|
Mutex
|
|
=====
|
|
|
|
**Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
|
|
|
|
**Category:** Core
|
|
|
|
Brief Description
|
|
-----------------
|
|
|
|
A synchronization Mutex.
|
|
|
|
Member Functions
|
|
----------------
|
|
|
|
+------------------------+---------------------------------------------------+
|
|
| void | :ref:`lock<class_Mutex_lock>` **(** **)** |
|
|
+------------------------+---------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`try_lock<class_Mutex_try_lock>` **(** **)** |
|
|
+------------------------+---------------------------------------------------+
|
|
| void | :ref:`unlock<class_Mutex_unlock>` **(** **)** |
|
|
+------------------------+---------------------------------------------------+
|
|
|
|
Description
|
|
-----------
|
|
|
|
A synchronization Mutex. Element used to synchronize multiple :ref:`Thread<class_thread>`\ s. Basically a binary :ref:`Semaphore<class_semaphore>`. Guarantees that only one thread can ever acquire this lock at a time. Can be used to protect a critical section. Be careful to avoid deadlocks.
|
|
|
|
Member Function Description
|
|
---------------------------
|
|
|
|
.. _class_Mutex_lock:
|
|
|
|
- void **lock** **(** **)**
|
|
|
|
Lock this ``Mutex``, blocks until it is unlocked by the current owner.
|
|
|
|
.. _class_Mutex_try_lock:
|
|
|
|
- :ref:`int<class_int>` **try_lock** **(** **)**
|
|
|
|
Try locking this ``Mutex``, does not block. Returns OK on success, ERR_BUSY otherwise.
|
|
|
|
.. _class_Mutex_unlock:
|
|
|
|
- void **unlock** **(** **)**
|
|
|
|
Unlock this ``Mutex``, leaving it to other threads.
|
|
|
|
|