8 #ifndef META_OCEAN_BASE_SIGNAL_H
9 #define META_OCEAN_BASE_SIGNAL_H
13 #if defined(_ANDROID) || defined(__linux__) || defined(__EMSCRIPTEN__)
14 #include <semaphore.h>
18 #include <dispatch/dispatch.h>
56 bool wait(
const unsigned int time)
const;
81 inline void* handle()
const;
100 #if defined(_WINDOWS)
105 #elif defined(__APPLE__)
122 std::atomic<bool> semaphoreObjectReleased;
167 bool wait(
const unsigned int time)
const;
175 bool waitSubset(
const unsigned int signalsCount,
const unsigned int time);
193 inline unsigned int size()
const;
This class implements a signal.
Definition: Signal.h:31
dispatch_semaphore_t semaphoreObject
Semaphore object for Apple platforms.
Definition: Signal.h:108
bool pulse()
Pulses this signal.
sem_t semaphoreObject
Semaphore object for e.g., Android platforms.
Definition: Signal.h:116
Signal(const Signal &otherSignal)=delete
Disabled copy constructor.
Signal & operator=(const Signal &otherSignal)=delete
Disabled assign operator.
void release()
Pulses the signal for the last time to allow a waiting process to proceed and releases the signal.
void * signalHandle
Signal handle for Windows platforms.
Definition: Signal.h:103
Signal()
Creates a new signal object.
bool semaphoreObjectState
True, if the semaphore object (for e.g., Android platforms) is valid and has been initialized.
Definition: Signal.h:119
void * handle() const
Returns the signal handle.
Definition: Signal.h:235
std::atomic< bool > semaphoreObjectReleased
True, if the semaphore object has been released and should not be used anymore.
Definition: Signal.h:111
void wait() const
Returns after the signal has been pulsed.
bool reset()
Resets the signal.
~Signal()
Destructs a signal object.
bool wait(const unsigned int time) const
Returns after the signal has been pulsed or the specified time elapsed.
This class implements a signal array.
Definition: Signal.h:132
~Signals()
Destructs a signal array.
void waitSubset(const unsigned int signalsCount) const
Returns after a subset of signals has been pulsed.
bool waitSubset(const unsigned int signalsCount, const unsigned int time)
Returns after a subset of signals has been pulsed or the specified time has been elapsed.
Signals(const Signals &otherSignals)=delete
Disabled copy constructor.
bool wait(const unsigned int time) const
Returns after all signals has been pulsed or the specified time has been elapsed.
Signals()
Creates an empty signal array.
bool pulse()
Pulses all signals.
void wait() const
Returns after all signals has been pulsed.
bool reset()
Resets all the signal.
Signals & operator=(const Signals &otherSignals)=delete
Disabled copy operator.
unsigned int size() const
Returns the number of signals.
Definition: Signal.h:242
Signals(const unsigned int size)
Creates a new signal array object by the number of requested signals.
void setSize(const unsigned int size)
Changes the size of the signal array.
Signal & operator[](const unsigned int index) const
Returns one specific signal of this array.
Signal * signalObjects
Array of stored signals.
Definition: Signal.h:227
unsigned int signalsSize
Number of signals stored in the array.
Definition: Signal.h:230
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15