Classes | Public Types | Public Member Functions | Private Attributes | List of all members
dispatcher Class Reference

#include <concurrency.h>

Classes

class  cancellable_timer
 

Public Types

typedef std::function< void(cancellable_timer const &)> action
 

Public Member Functions

 dispatcher (unsigned int cap, std::function< void(action)> on_drop_callback=nullptr)
 
bool empty ()
 
bool flush ()
 
template<class T >
void invoke (T item, bool is_blocking=false)
 
template<class T >
void invoke_and_wait (T item, std::function< bool()> exit_condition, bool is_blocking=false)
 
void start ()
 
void stop ()
 
 ~dispatcher ()
 

Private Attributes

std::condition_variable _blocking_invoke_cv
 
std::mutex _blocking_invoke_mutex
 
std::atomic< bool > _is_alive
 
single_consumer_queue< std::function< void(cancellable_timer)> > _queue
 
std::thread _thread
 
std::atomic< bool > _was_flushed
 
std::condition_variable _was_flushed_cv
 
std::mutex _was_flushed_mutex
 
std::atomic< bool > _was_stopped
 
std::condition_variable _was_stopped_cv
 
std::mutex _was_stopped_mutex
 
friend cancellable_timer
 

Detailed Description

Definition at line 194 of file concurrency.h.

Member Typedef Documentation

typedef std::function<void(cancellable_timer const &)> dispatcher::action

Definition at line 216 of file concurrency.h.

Constructor & Destructor Documentation

dispatcher::dispatcher ( unsigned int  cap,
std::function< void(action)>  on_drop_callback = nullptr 
)
inline

Definition at line 217 of file concurrency.h.

dispatcher::~dispatcher ( )
inline

Definition at line 318 of file concurrency.h.

Member Function Documentation

bool dispatcher::empty ( )
inline

Definition at line 351 of file concurrency.h.

bool dispatcher::flush ( )
inline

TODO: use _queue to flush, and implement properly

Definition at line 328 of file concurrency.h.

template<class T >
void dispatcher::invoke ( item,
bool  is_blocking = false 
)
inline

Definition at line 254 of file concurrency.h.

template<class T >
void dispatcher::invoke_and_wait ( item,
std::function< bool()>  exit_condition,
bool  is_blocking = false 
)
inline

Definition at line 266 of file concurrency.h.

void dispatcher::start ( )
inline

Definition at line 286 of file concurrency.h.

void dispatcher::stop ( )
inline

Definition at line 294 of file concurrency.h.

Member Data Documentation

std::condition_variable dispatcher::_blocking_invoke_cv
private

Definition at line 369 of file concurrency.h.

std::mutex dispatcher::_blocking_invoke_mutex
private

Definition at line 370 of file concurrency.h.

std::atomic<bool> dispatcher::_is_alive
private

Definition at line 372 of file concurrency.h.

single_consumer_queue<std::function<void(cancellable_timer)> > dispatcher::_queue
private

Definition at line 358 of file concurrency.h.

std::thread dispatcher::_thread
private

Definition at line 359 of file concurrency.h.

std::atomic<bool> dispatcher::_was_flushed
private

Definition at line 365 of file concurrency.h.

std::condition_variable dispatcher::_was_flushed_cv
private

Definition at line 366 of file concurrency.h.

std::mutex dispatcher::_was_flushed_mutex
private

Definition at line 367 of file concurrency.h.

std::atomic<bool> dispatcher::_was_stopped
private

Definition at line 361 of file concurrency.h.

std::condition_variable dispatcher::_was_stopped_cv
private

Definition at line 362 of file concurrency.h.

std::mutex dispatcher::_was_stopped_mutex
private

Definition at line 363 of file concurrency.h.

Definition at line 357 of file concurrency.h.


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


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:31