CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | List of all members
CYB::API::Semaphore Class Referenceabstract

A reliable wait queue. More...

#include <Semaphore.hpp>

Inheritance diagram for CYB::API::Semaphore:
Inheritance graph
[legend]
Collaboration diagram for CYB::API::Semaphore:
Collaboration graph
[legend]

Public Types

using Constructor = Interop::EmptyConstructor
 See Interop Construction. More...
 
- Public Types inherited from CYB::API::Interop::Allocatable
enum  ID {
  ID::NULL_ID, ID::File, ID::Mutex, ID::Path,
  ID::Semaphore
}
 Defines the IDs of allocatable engine objects. More...
 
using Constructor = NullConstructor
 Override in descendants.
 
using CopyConstructor = NullConstructor
 Override in descendants.
 

Public Member Functions

virtual ~Semaphore ()=default
 Destroy a Semaphore. Semaphore must have no waiters.
 
virtual void SignalN (const unsigned long long AN) noexcept=0
 Signal N waiters of this semaphore. Will not signal more than are currently waiting. More...
 
virtual void SignalAll (void) noexcept=0
 Signal all current waiters of this semaphore. More...
 
virtual void Wait (void) noexcept=0
 Wait indefinitely for a signal from this semaphore. Will be placed last into the queue. More...
 
- Public Member Functions inherited from CYB::API::Interop::Allocatable
virtual ~Allocatable ()=default
 See Default Constructors and Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from CYB::API::Interop::Allocatable
template<class AParent >
static constexpr ID GetID (void)
 Returns the ID of an allocatable object. More...
 

Detailed Description

A reliable wait queue.

WARNING
Using Semaphore's incorrectly results in hard to detect undefined behaviour, proceed with caution

Definition at line 9 of file Semaphore.hpp.

Member Typedef Documentation

See Interop Construction.

Exceptions
CYB::Exception::SystemDataError code: CYB::Exception::SystemData::MUTEX_INITIALIZATION_FAILURE Thrown if the internal mutex could not be initialized

Definition at line 15 of file Semaphore.hpp.

Member Function Documentation

virtual void CYB::API::Semaphore::SignalAll ( void  )
pure virtualnoexcept

Signal all current waiters of this semaphore.

Thread Safety
This function requires no thread safety

Implemented in CYB::Platform::System::Semaphore.

virtual void CYB::API::Semaphore::SignalN ( const unsigned long long  AN)
pure virtualnoexcept

Signal N waiters of this semaphore. Will not signal more than are currently waiting.

Parameters
ANthe number of waiters to wake
Thread Safety
This function requires no thread safety

Implemented in CYB::Platform::System::Semaphore.

virtual void CYB::API::Semaphore::Wait ( void  )
pure virtualnoexcept

Wait indefinitely for a signal from this semaphore. Will be placed last into the queue.

Thread Safety
This function requires no thread safety

Implemented in CYB::Platform::System::Semaphore.


The documentation for this class was generated from the following file: