class_mutex.rst 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Mutex:
  4. Mutex
  5. =====
  6. **Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. A synchronization Mutex.
  11. Member Functions
  12. ----------------
  13. +--------+----------------------------------------------------+
  14. | void | :ref:`lock<class_Mutex_lock>` **(** **)** |
  15. +--------+----------------------------------------------------+
  16. | Error | :ref:`try_lock<class_Mutex_try_lock>` **(** **)** |
  17. +--------+----------------------------------------------------+
  18. | void | :ref:`unlock<class_Mutex_unlock>` **(** **)** |
  19. +--------+----------------------------------------------------+
  20. Description
  21. -----------
  22. 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.
  23. Member Function Description
  24. ---------------------------
  25. .. _class_Mutex_lock:
  26. - void **lock** **(** **)**
  27. Lock this :ref:`Mutex<class_mutex>`, blocks until it is unlocked by the current owner.
  28. .. _class_Mutex_try_lock:
  29. - Error **try_lock** **(** **)**
  30. Try locking this :ref:`Mutex<class_mutex>`, does not block. Returns OK on success else ERR_BUSY.
  31. .. _class_Mutex_unlock:
  32. - void **unlock** **(** **)**
  33. Unlock this :ref:`Mutex<class_mutex>`, leaving it to others threads.