class_semaphore.rst 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Semaphore.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Semaphore:
  5. Semaphore
  6. =========
  7. **Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A synchronization Semaphore.
  12. Member Functions
  13. ----------------
  14. +------------------------+-----------------------------------------------+
  15. | :ref:`int<class_int>` | :ref:`post<class_Semaphore_post>` **(** **)** |
  16. +------------------------+-----------------------------------------------+
  17. | :ref:`int<class_int>` | :ref:`wait<class_Semaphore_wait>` **(** **)** |
  18. +------------------------+-----------------------------------------------+
  19. Description
  20. -----------
  21. A synchronization Semaphore. Element used to synchronize multiple :ref:`Thread<class_thread>`\ s. Initialized to zero on creation. Be careful to avoid deadlocks. For a binary version, see :ref:`Mutex<class_mutex>`.
  22. Member Function Description
  23. ---------------------------
  24. .. _class_Semaphore_post:
  25. - :ref:`int<class_int>` **post** **(** **)**
  26. Lowers the ``Semaphore``, allowing one more thread in. Returns OK on success, ERR_BUSY otherwise.
  27. .. _class_Semaphore_wait:
  28. - :ref:`int<class_int>` **wait** **(** **)**
  29. Tries to wait for the ``Semaphore``, if its value is zero, blocks until non-zero. Returns OK on success, ERR_BUSY otherwise.