diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2020-03-03 09:26:42 +0100 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2020-03-03 13:20:42 +0100 |
commit | 9a3a2b03b8b718409eb26252d742d48091756ef7 (patch) | |
tree | 94cc5ae822288ec8b1e098773338498f865b5b77 /doc/classes | |
parent | c9768f15f7bb194622b9020ab2614d47ac7e63dd (diff) |
Drop old semaphore implementation
- Removed platform-specific implementations.
- Now all semaphores are in-object, unless they need to be conditionally created.
- Similarly to `Mutex`, provided a dummy implementation for when `NO_THREADS` is defined.
- Similarly to `Mutex`, methods are made `const` for easy use in such contexts.
- Language bindings updated: `wait()` and `post()` are now `void`.
- Language bindings updated: `try_wait()` added.
Bonus:
- Rewritten the `#ifdef` in `mutex.h` to meet the code style.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/Semaphore.xml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/doc/classes/Semaphore.xml b/doc/classes/Semaphore.xml index eca98fb10e..19719eea93 100644 --- a/doc/classes/Semaphore.xml +++ b/doc/classes/Semaphore.xml @@ -11,17 +11,24 @@ </tutorials> <methods> <method name="post"> - <return type="int" enum="Error"> + <return type="void"> </return> <description> - Lowers the [Semaphore], allowing one more thread in. Returns [constant OK] on success, [constant ERR_BUSY] otherwise. + Lowers the [Semaphore], allowing one more thread in. </description> </method> <method name="wait"> + <return type="void"> + </return> + <description> + Waits for the [Semaphore], if its value is zero, blocks until non-zero. + </description> + </method> + <method name="try_wait"> <return type="int" enum="Error"> </return> <description> - Tries to wait for the [Semaphore], if its value is zero, blocks until non-zero. Returns [constant OK] on success, [constant ERR_BUSY] otherwise. + 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. </description> </method> </methods> |