NAP
Public Member Functions | List of all members
AsyncObserver Class Reference

#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 ()
 

Description

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.

Constructor & Destructor Documentation

◆ AsyncObserver()

AsyncObserver ( )
default

◆ ~AsyncObserver()

~AsyncObserver ( )
default

Member Function Documentation

◆ notifyAll()

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.

◆ notifyBarrier()

void notifyBarrier ( )

A performing thread needs to call this method to notify the waiting threads that it has finished.

◆ notifyOne()

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.

◆ setBarrier()

void setBarrier ( uint32_t  numberOfNotifications = 1)

Sets the number of performing threads that the waiting threads need to wait for to finish

Parameters
numberOfNotificationsthe number of notifications that will be collected until resuming after the wait.

◆ waitForNotifications()

void waitForNotifications ( )

The waiting threads call this method to wait for all performing threads to finish.