class_mutex.rst 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Mutex.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Mutex:
  5. Mutex
  6. =====
  7. **Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A synchronization Mutex.
  12. Member Functions
  13. ----------------
  14. +------------------------+----------------------------------------------------+
  15. | void | :ref:`lock<class_Mutex_lock>` **(** **)** |
  16. +------------------------+----------------------------------------------------+
  17. | :ref:`int<class_int>` | :ref:`try_lock<class_Mutex_try_lock>` **(** **)** |
  18. +------------------------+----------------------------------------------------+
  19. | void | :ref:`unlock<class_Mutex_unlock>` **(** **)** |
  20. +------------------------+----------------------------------------------------+
  21. Description
  22. -----------
  23. A synchronization Mutex. Element used in multi-threadding. Basically a binary :ref:`Semaphore<class_semaphore>`. Guarantees that only one thread has this lock, can be used to protect a critical section.
  24. Member Function Description
  25. ---------------------------
  26. .. _class_Mutex_lock:
  27. - void **lock** **(** **)**
  28. Lock this :ref:`Mutex<class_mutex>`, blocks until it is unlocked by the current owner.
  29. .. _class_Mutex_try_lock:
  30. - :ref:`int<class_int>` **try_lock** **(** **)**
  31. Try locking this :ref:`Mutex<class_mutex>`, does not block. Returns OK on success else ERR_BUSY.
  32. .. _class_Mutex_unlock:
  33. - void **unlock** **(** **)**
  34. Unlock this :ref:`Mutex<class_mutex>`, leaving it to others threads.