Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utils::ValueLatch< T > Class Template Reference

#include <value-latch.hpp>

Public Member Functions

void set (const T &value)
 Assigns value to kept variable and sets Latch. More...
 
void set (T &&value)
 Assigns value to kept variable and sets Latch. More...
 
get ()
 Waits until set() is called, then set value is moved to caller. More...
 
get (const unsigned int timeoutMs)
 Waits until set() is called, or until timeout occurs. More...
 

Private Attributes

std::mutex mMutex
 
std::condition_variable mCondition
 
std::unique_ptr< T > mValue
 

Member Function Documentation

template<typename T >
T utils::ValueLatch< T >::get ( )

Waits until set() is called, then set value is moved to caller.

Returns
Value provided by set().
template<typename T >
T utils::ValueLatch< T >::get ( const unsigned int  timeoutMs)

Waits until set() is called, or until timeout occurs.

Then, set value is moved to caller.

Parameters
timeoutMsMaximum time to wait for value to be set.
Returns
Value provided by set().
template<typename T >
void utils::ValueLatch< T >::set ( const T &  value)

Assigns value to kept variable and sets Latch.

Parameters
valueValue to set.
template<typename T >
void utils::ValueLatch< T >::set ( T &&  value)

Assigns value to kept variable and sets Latch.

Parameters
valueValue to set.

Member Data Documentation

template<typename T >
std::condition_variable utils::ValueLatch< T >::mCondition
private
template<typename T >
std::mutex utils::ValueLatch< T >::mMutex
private
template<typename T >
std::unique_ptr<T> utils::ValueLatch< T >::mValue
private

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