Semaphore.xml 1.1 KB

123456789101112131415161718192021222324252627282930
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Semaphore" inherits="Reference" version="3.4">
  3. <brief_description>
  4. A synchronization semaphore.
  5. </brief_description>
  6. <description>
  7. A synchronization semaphore which can be used to synchronize multiple [Thread]s. Initialized to zero on creation. Be careful to avoid deadlocks. For a binary version, see [Mutex].
  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="post">
  14. <return type="int" enum="Error">
  15. </return>
  16. <description>
  17. Lowers the [Semaphore], allowing one more thread in. Returns [constant OK] on success, [constant ERR_BUSY] otherwise.
  18. </description>
  19. </method>
  20. <method name="wait">
  21. <return type="int" enum="Error">
  22. </return>
  23. <description>
  24. Tries to wait for the [Semaphore], if its value is zero, blocks until non-zero. Returns [constant OK] on success, [constant ERR_BUSY] otherwise.
  25. </description>
  26. </method>
  27. </methods>
  28. <constants>
  29. </constants>
  30. </class>