mirror of
https://github.com/Relintai/pandemonium_engine_docs.git
synced 2025-01-23 15:17:21 +01:00
70 lines
3.0 KiB
ReStructuredText
70 lines
3.0 KiB
ReStructuredText
|
:github_url: hide
|
||
|
|
||
|
.. DO NOT EDIT THIS FILE!!!
|
||
|
.. Generated automatically from Godot engine sources.
|
||
|
.. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
|
||
|
.. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/Semaphore.xml.
|
||
|
|
||
|
.. _class_Semaphore:
|
||
|
|
||
|
Semaphore
|
||
|
=========
|
||
|
|
||
|
**Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
|
||
|
|
||
|
A synchronization semaphore.
|
||
|
|
||
|
Description
|
||
|
-----------
|
||
|
|
||
|
A synchronization semaphore which can be 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>`.
|
||
|
|
||
|
Tutorials
|
||
|
---------
|
||
|
|
||
|
- :doc:`../tutorials/performance/threads/using_multiple_threads`
|
||
|
|
||
|
Methods
|
||
|
-------
|
||
|
|
||
|
+---------------------------------------+--------------------------------------------------------------+
|
||
|
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`post<class_Semaphore_method_post>` **(** **)** |
|
||
|
+---------------------------------------+--------------------------------------------------------------+
|
||
|
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`try_wait<class_Semaphore_method_try_wait>` **(** **)** |
|
||
|
+---------------------------------------+--------------------------------------------------------------+
|
||
|
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`wait<class_Semaphore_method_wait>` **(** **)** |
|
||
|
+---------------------------------------+--------------------------------------------------------------+
|
||
|
|
||
|
Method Descriptions
|
||
|
-------------------
|
||
|
|
||
|
.. _class_Semaphore_method_post:
|
||
|
|
||
|
- :ref:`Error<enum_@GlobalScope_Error>` **post** **(** **)**
|
||
|
|
||
|
Lowers the ``Semaphore``, allowing one more thread in.
|
||
|
|
||
|
\ **Note:** This method internals' can't possibly fail, but an error code is returned for backwards compatibility, which will always be :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>`.
|
||
|
|
||
|
----
|
||
|
|
||
|
.. _class_Semaphore_method_try_wait:
|
||
|
|
||
|
- :ref:`Error<enum_@GlobalScope_Error>` **try_wait** **(** **)**
|
||
|
|
||
|
Like :ref:`wait<class_Semaphore_method_wait>`, but won't block, so if the value is zero, fails immediately and returns :ref:`@GlobalScope.ERR_BUSY<class_@GlobalScope_constant_ERR_BUSY>`. If non-zero, it returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` to report success.
|
||
|
|
||
|
----
|
||
|
|
||
|
.. _class_Semaphore_method_wait:
|
||
|
|
||
|
- :ref:`Error<enum_@GlobalScope_Error>` **wait** **(** **)**
|
||
|
|
||
|
Waits for the ``Semaphore``, if its value is zero, blocks until non-zero.
|
||
|
|
||
|
\ **Note:** This method internals' can't possibly fail, but an error code is returned for backwards compatibility, which will always be :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>`.
|
||
|
|
||
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
||
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
||
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|