Shaka Player Embedded
|
#include <thread_event.h>
Public Member Functions | |
ThreadEvent (const std::string &name) | |
~ThreadEvent () override | |
T | GetValue () |
std::shared_future< T > | future () |
template<typename _Mutex > | |
T | ResetAndWaitWhileUnlocked (std::unique_lock< _Mutex > &lock) |
void | Reset () |
void | SignalAll () |
template<typename U > | |
void | SignalAll (U &&value) |
bool | SignalAllIfNotSet () |
template<typename U > | |
bool | SignalAllIfNotSet (U &&value) |
![]() | |
ThreadEventBase (const std::string &name) | |
~ThreadEventBase () override | |
std::thread::id | GetProvider () const override |
void | SetProvider (Thread *thread) |
![]() | |
Waitable (const std::string &name) | |
virtual | ~Waitable () |
std::string | name () const |
Describes something that needs to happen on a different thread. One (or more) threads will wait for this event; another thread will be "providing" the event. The event will only complete on the providing thread.
This object is internally thread-safe. To safely manage memory, it is suggested to use std::shared_ptr<T> to share this object.
Definition at line 70 of file thread_event.h.
|
inlineexplicit |
Definition at line 72 of file thread_event.h.
|
inlineoverride |
Definition at line 74 of file thread_event.h.
|
inline |
Gets the future that is used for this event. It is not advised to use this as this won't include deadlock detection.
Definition at line 93 of file thread_event.h.
|
inline |
Definition at line 76 of file thread_event.h.
|
inline |
Resets the internal future so it can be used again. This asserts that there are no waiting threads, so it is important to call SignalAll() before this so any waiting threads will get the value.
Calls to get() after this call will need to wait until the next call to SignalAll().
Definition at line 180 of file thread_event.h.
|
inline |
Resets this object, unlocks the given lock, and waits for this event to get another signal from another thread. This is similar to how the wait() method works on a std::condition_variable.
When this returns, the lock will be acquired again.
Definition at line 106 of file thread_event.h.
|
inline |
Sets the result of the event. This can only be called once per-Reset(). Calling Reset() will allow this to be called again.
Definition at line 128 of file thread_event.h.
|
inline |
Sets the result of the event. This can only be called once per-Reset(). Calling Reset() will allow this to be called again.
Definition at line 132 of file thread_event.h.
|
inline |
Sets the result of the event if it has not already been set. If this has already been set, this has no effect.
Definition at line 143 of file thread_event.h.
|
inline |
Sets the result of the event if it has not already been set. If this has already been set, this has no effect.
Definition at line 158 of file thread_event.h.