mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-04 10:09:56 +03:00
Currently including `zh_CN` and `es` which both have very high completion ratios. Others will be added once they reach a significant percentage too. These RST files will be used by godot-docs in place of its `classes` folder after we sync with https://github.com/godotengine/godot-docs/pull/5458. The update workflow is manual for now (example for `zh_CN`): - Build `godotengine/godot` in the branch we currently track (now `3.x`) - Run `godot --doctool -l zh_CN` - Run `cd doc && make rst LANGARG=zh_CN` - Copy `doc/_build/rst/*` to `classes/zh_CN/` here - Make sure to have `classes/zh_CN/index.rst` copied from `docs/classes`
71 lines
3.1 KiB
ReStructuredText
71 lines
3.1 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.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>`
|
|
|
|
Un mutex de sincronización (exclusión mutua).
|
|
|
|
Descripción
|
|
----------------------
|
|
|
|
Un mutex de sincronización (exclusión mutua). Se utiliza para sincronizar múltiples :ref:`Thread<class_Thread>`\ s, y equivale a un :ref:`Semaphore<class_Semaphore>` binario. Garantiza que sólo un hilo puede adquirir el bloqueo a la vez. Un mutex puede utilizarse para proteger una sección crítica; sin embargo, hay que tener cuidado de evitar los bloqueos.
|
|
|
|
Tutoriales
|
|
--------------------
|
|
|
|
- :doc:`../tutorials/performance/threads/using_multiple_threads`
|
|
|
|
Métodos
|
|
--------------
|
|
|
|
+---------------------------------------+----------------------------------------------------------+
|
|
| void | :ref:`lock<class_Mutex_method_lock>` **(** **)** |
|
|
+---------------------------------------+----------------------------------------------------------+
|
|
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`try_lock<class_Mutex_method_try_lock>` **(** **)** |
|
|
+---------------------------------------+----------------------------------------------------------+
|
|
| void | :ref:`unlock<class_Mutex_method_unlock>` **(** **)** |
|
|
+---------------------------------------+----------------------------------------------------------+
|
|
|
|
Descripciones de Métodos
|
|
------------------------------------------------
|
|
|
|
.. _class_Mutex_method_lock:
|
|
|
|
- void **lock** **(** **)**
|
|
|
|
Locks this ``Mutex``, blocks until it is unlocked by the current owner.
|
|
|
|
\ **Note:** This function returns without blocking if the thread already has ownership of the mutex.
|
|
|
|
----
|
|
|
|
.. _class_Mutex_method_try_lock:
|
|
|
|
- :ref:`Error<enum_@GlobalScope_Error>` **try_lock** **(** **)**
|
|
|
|
Tries locking this ``Mutex``, but does not block. Returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` on success, :ref:`@GlobalScope.ERR_BUSY<class_@GlobalScope_constant_ERR_BUSY>` otherwise.
|
|
|
|
\ **Note:** This function returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` if the thread already has ownership of the mutex.
|
|
|
|
----
|
|
|
|
.. _class_Mutex_method_unlock:
|
|
|
|
- void **unlock** **(** **)**
|
|
|
|
Unlocks this ``Mutex``, leaving it to other threads.
|
|
|
|
\ **Note:** If a thread called :ref:`lock<class_Mutex_method_lock>` or :ref:`try_lock<class_Mutex_method_try_lock>` multiple times while already having ownership of the mutex, it must also call :ref:`unlock<class_Mutex_method_unlock>` the same number of times in order to unlock it correctly.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|