AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::avsCommon::utils::threading::ConditionVariableWrapper Class Reference

#include <ConditionVariableWrapper.h>

Public Member Functions

 ConditionVariableWrapper ()
 Constructor. More...
 
void notifyOne ()
 
void notifyAll ()
 
template<typename Predicate >
void wait (std::unique_lock< std::mutex > &lock, Predicate pred)
 
template<typename Rep , typename Period , typename Predicate >
bool waitFor (std::unique_lock< std::mutex > &lock, const std::chrono::duration< Rep, Period > &rel_time, Predicate pred)
 
template<typename Clock , typename Duration , typename Predicate >
bool waitUntil (std::unique_lock< std::mutex > &lock, const std::chrono::time_point< Clock, Duration > &timeout_time, Predicate pred)
 

Static Public Member Functions

static std::string getTag ()
 

Detailed Description

A wrapper around the standard std::condition_variable class that supports different power levels. Functionally it is the same as std::condition_variable.

Methods not containing a predicate param are omitted.

Constructor & Destructor Documentation

◆ ConditionVariableWrapper()

alexaClientSDK::avsCommon::utils::threading::ConditionVariableWrapper::ConditionVariableWrapper ( )

Constructor.

Member Function Documentation

◆ getTag()

static std::string alexaClientSDK::avsCommon::utils::threading::ConditionVariableWrapper::getTag ( )
inlinestatic

Returns the tag for logging purposes.

◆ notifyAll()

void alexaClientSDK::avsCommon::utils::threading::ConditionVariableWrapper::notifyAll ( )

Notifies all threads waiting on the ConditionVariableWrapper.

◆ notifyOne()

void alexaClientSDK::avsCommon::utils::threading::ConditionVariableWrapper::notifyOne ( )

Notifies one thread waiting on the ConditionVariableWrapper.

◆ wait()

template<typename Predicate >
void alexaClientSDK::avsCommon::utils::threading::ConditionVariableWrapper::wait ( std::unique_lock< std::mutex > &  lock,
Predicate  pred 
)

This function will freeze any associated thread PowerResource on the thread, ensuring that the system may enter a lower power state upon waiting. Upon unblocking, the thread PowerResource will be thawed.

Refer to documentation for std::condition_variable for more information on standard behavior.

Template Parameters
PredicateThe predicate to evaluate.
Parameters
lockThe locked mutex.
predThe predicate to evaluate.

◆ waitFor()

template<typename Rep , typename Period , typename Predicate >
bool alexaClientSDK::avsCommon::utils::threading::ConditionVariableWrapper::waitFor ( std::unique_lock< std::mutex > &  lock,
const std::chrono::duration< Rep, Period > &  rel_time,
Predicate  pred 
)

This function will freeze any associated thread PowerResource on the thread, ensuring that the system may enter a lower power state upon waiting. Upon unblocking, the thread PowerResource will be thawed.

Refer to documentation for std::condition_variable for more information on standard behavior.

Template Parameters
RepThe data type used in representing the duration.
PeriodThe period used in representing the duration.
PredicateThe predicate to evaluate.
Parameters
lockThe locked mutex.
rel_timeThe time to wait for.
predThe predicate to evaluate.
Returns
The evaluation of pred.

◆ waitUntil()

template<typename Clock , typename Duration , typename Predicate >
bool alexaClientSDK::avsCommon::utils::threading::ConditionVariableWrapper::waitUntil ( std::unique_lock< std::mutex > &  lock,
const std::chrono::time_point< Clock, Duration > &  timeout_time,
Predicate  pred 
)

This function will freeze any associated thread PowerResource on the thread, ensuring that the system may enter a lower power state upon waiting. Upon unblocking, the thread PowerResource will be thawed.

Refer to documentation for std::condition_variable for more information on standard behavior.

Template Parameters
ClockThe clock.
DurationThe duration.
PredThe predicate to evaluate.
Parameters
lockThe locked mutex.
timeout_timeThe time to wait until.
predThe predicate to evaluate.
Returns
The evaluation of pred.

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

AlexaClientSDK 1.26.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0