#include <audio/utility/asyncobserver.h>
Public Member Functions | |
AsyncObserver ()=default | |
~AsyncObserver ()=default | |
void | setBarrier (uint32_t numberOfNotifications=1) |
void | notifyBarrier () |
void | waitForNotifications () |
void | notifyOne () |
void | notifyAll () |
The AsyncObserver will assist you when one or more threads need to wait for any number of other threads to finish performing certain tasks. We will call these threads respectively the waiting threads and the performing threads.
|
default |
|
default |
void notifyAll | ( | ) |
In case of multiple waiting threads, a performing thread can call this method to wake up the waiting threads and continue their execution.
void notifyBarrier | ( | ) |
A performing thread needs to call this method to notify the waiting threads that it has finished.
void notifyOne | ( | ) |
In the case of a single waiting thread, a performing thread can call this method to wake up the waiting thread and continue its execution.
void setBarrier | ( | uint32_t | numberOfNotifications = 1 | ) |
Sets the number of performing threads that the waiting threads need to wait for to finish
numberOfNotifications | the number of notifications that will be collected until resuming after the wait. |
void waitForNotifications | ( | ) |
The waiting threads call this method to wait for all performing threads to finish.