Handle to an owned semaphore.
More...
|
void | Destroy () |
| Destroy a semaphore.
|
|
SemaphoreShared | share () |
| Move this semaphore into a SemaphoreShared.
|
|
constexpr | ResourceUnique (std::nullptr_t=nullptr) |
| Default constructor.
|
|
constexpr | ResourceUnique (base::value_type value, DELETER deleter={}) |
| Constructs from raw type.
|
|
constexpr | ResourceUnique (ResourceUnique &&other) |
| Move constructor.
|
|
| ResourceUnique (const ResourceUnique &other)=delete |
|
constexpr | ResourceUnique (std::nullptr_t=nullptr) |
| Default constructor.
|
|
constexpr | ResourceUnique (base::value_type value, DefaultDeleter< SemaphoreRef > deleter={}) |
| Constructs from raw type.
|
|
constexpr | ResourceUnique (ResourceUnique &&other) |
| Move constructor.
|
|
| ResourceUnique (const ResourceUnique &other)=delete |
|
| ~ResourceUnique () |
| Destructor.
|
|
constexpr ResourceUnique & | operator= (ResourceUnique other) |
| Assignment operator.
|
|
void | reset () |
| Resets the value, destroying the resource if not nullptr.
|
|
RESOURCE | release () |
| Returns reference and reset this.
|
|
constexpr | operator bool () const |
| Check if not null.
|
|
constexpr bool | operator== (const ResourcePtrBase &other) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullptr_t) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullopt_t) const |
| Comparison.
|
|
constexpr reference | operator* () const |
| Gets reference.
|
|
constexpr const reference * | operator-> () const |
| Gets addressable reference.
|
|
constexpr reference * | operator-> () |
| Gets addressable reference.
|
|
reference | get () const |
| Get reference.
|
|
|
using | deleter = DELETER |
| The deleter type.
|
|
using | reference = RESOURCE |
| The reference resource type.
|
|
using | value_type = typename reference::value_type |
| The raw resource type.
|
|
constexpr | ResourceOwnerBase (base::value_type value={}, DELETER deleter={}) |
| Constructs from raw type.
|
|
void | free () |
| Frees resource.
|
|
constexpr | ResourcePtrBase (value_type value={}) |
| Constructs from raw type.
|
|
reference & | get () |
| Get reference.
|
|
◆ Create()
static Semaphore SDL::Semaphore::Create |
( |
Uint32 |
initial_value | ) |
|
|
inlinestatic |
This function creates a new semaphore and initializes it with the value initial_value
. Each wait operation on the semaphore will atomically decrement the semaphore value and potentially block if the semaphore value is 0. Each post operation will atomically increment the semaphore value and wake waiting threads and allow them to retry the wait operation.
- Parameters
-
initial_value | the starting value of the semaphore. |
- Returns
- a new semaphore or nullptr on failure; call GetError() for more information.
- Since
- This function is available since SDL 3.2.0.
- See also
- Semaphore.Destroy
-
SemaphoreRef.Signal
-
SemaphoreRef.TryWait
-
SemaphoreRef.GetValue
-
SemaphoreRef.Wait
-
SemaphoreRef.WaitTimeout
◆ Destroy()
void SDL::Semaphore::Destroy |
( |
| ) |
|
|
inline |
It is not safe to destroy a semaphore if there are threads currently waiting on it.
- Since
- This function is available since SDL 3.2.0.
- See also
- Semaphore.Create
The documentation for this struct was generated from the following file: