Mutex.xml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Mutex" inherits="Reference" version="3.4">
  3. <brief_description>
  4. A synchronization mutex (mutual exclusion).
  5. </brief_description>
  6. <description>
  7. A synchronization mutex (mutual exclusion). This is used to synchronize multiple [Thread]s, and is equivalent to a binary [Semaphore]. It guarantees that only one thread can ever acquire the lock at a time. A mutex can be used to protect a critical section; however, be careful to avoid deadlocks.
  8. </description>
  9. <tutorials>
  10. <link>https://docs.godotengine.org/en/3.3/tutorials/threads/using_multiple_threads.html</link>
  11. </tutorials>
  12. <methods>
  13. <method name="lock">
  14. <return type="void">
  15. </return>
  16. <description>
  17. Locks this [Mutex], blocks until it is unlocked by the current owner.
  18. </description>
  19. </method>
  20. <method name="try_lock">
  21. <return type="int" enum="Error">
  22. </return>
  23. <description>
  24. Tries locking this [Mutex], but does not block. Returns [constant OK] on success, [constant ERR_BUSY] otherwise.
  25. </description>
  26. </method>
  27. <method name="unlock">
  28. <return type="void">
  29. </return>
  30. <description>
  31. Unlocks this [Mutex], leaving it to other threads.
  32. </description>
  33. </method>
  34. </methods>
  35. <constants>
  36. </constants>
  37. </class>