Semaphore.xml 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Semaphore" inherits="RefCounted" version="4.0">
  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 title="Using multiple threads">https://docs.godotengine.org/en/latest/tutorials/performance/using_multiple_threads.html</link>
  11. </tutorials>
  12. <methods>
  13. <method name="post">
  14. <return type="void" />
  15. <description>
  16. Lowers the [Semaphore], allowing one more thread in.
  17. </description>
  18. </method>
  19. <method name="try_wait">
  20. <return type="int" enum="Error" />
  21. <description>
  22. Like [method wait], but won't block, so if the value is zero, fails immediately and returns [constant ERR_BUSY]. If non-zero, it returns [constant OK] to report success.
  23. </description>
  24. </method>
  25. <method name="wait">
  26. <return type="void" />
  27. <description>
  28. Waits for the [Semaphore], if its value is zero, blocks until non-zero.
  29. </description>
  30. </method>
  31. </methods>
  32. </class>