foobar2000 SDK  2015-08-03
Public Member Functions | Private Member Functions | Private Attributes
ThreadUtils::CObjectQueue< TWhat >

#include <ThreadUtils.h>

Public Member Functions

 CObjectQueue ()
 
template<typename TSource >
void Add (const TSource &source)
 
template<typename TDestination >
void Get (TDestination &out, abort_callback &abort)
 
template<typename TDestination >
void Get_MsgLoop (TDestination &out, abort_callback &abort)
 

Private Member Functions

template<typename TDestination >
void _Get (TDestination &out)
 

Private Attributes

pfc::chain_list_v2_t< TWhat > m_content
 
win32_event m_event
 
critical_section m_sync
 

Detailed Description

template<typename TWhat>
class ThreadUtils::CObjectQueue< TWhat >

Definition at line 133 of file ThreadUtils.h.

Constructor & Destructor Documentation

template<typename TWhat>
ThreadUtils::CObjectQueue< TWhat >::CObjectQueue ( )
inline

Definition at line 135 of file ThreadUtils.h.

135 { m_event.create(true,false); }
void create(bool p_manualreset, bool p_initialstate)

Member Function Documentation

template<typename TWhat>
template<typename TDestination >
void ThreadUtils::CObjectQueue< TWhat >::_Get ( TDestination &  out)
inlineprivate

Definition at line 153 of file ThreadUtils.h.

153  {
154  insync(m_sync);
156  FB2K_DYNAMIC_ASSERT( iter.is_valid() );
157  out = *iter;
158  m_content.remove(iter);
159  if (m_content.get_count() == 0) m_event.set_state(false);
160  }
bool is_valid() const
Definition: iterators.h:24
pfc::chain_list_v2_t< TWhat > m_content
Definition: ThreadUtils.h:163
void remove(const_iterator const &p_iter)
Definition: chain_list_v2.h:73
t_size get_count() const
Definition: chain_list_v2.h:61
critical_section m_sync
Definition: ThreadUtils.h:162
void set_state(bool p_state)
template<typename TWhat>
template<typename TSource >
void ThreadUtils::CObjectQueue< TWhat >::Add ( const TSource &  source)
inline

Definition at line 137 of file ThreadUtils.h.

137  {
138  insync(m_sync);
139  m_content.add_item(source);
140  if (m_content.get_count() == 1) m_event.set_state(true);
141  }
void add_item(const t_source &p_source)
pfc::chain_list_v2_t< TWhat > m_content
Definition: ThreadUtils.h:163
t_size get_count() const
Definition: chain_list_v2.h:61
critical_section m_sync
Definition: ThreadUtils.h:162
void set_state(bool p_state)
template<typename TWhat>
template<typename TDestination >
void ThreadUtils::CObjectQueue< TWhat >::Get ( TDestination &  out,
abort_callback abort 
)
inline

Definition at line 142 of file ThreadUtils.h.

142  {
143  WaitAbortable(m_event.get(), abort);
144  _Get(out);
145  }
void _Get(TDestination &out)
Definition: ThreadUtils.h:153
static bool WaitAbortable(HANDLE ev, abort_callback &abort, DWORD timeout=INFINITE)
Definition: ThreadUtils.h:2
HANDLE get() const
Definition: win-objects.h:131
template<typename TWhat>
template<typename TDestination >
void ThreadUtils::CObjectQueue< TWhat >::Get_MsgLoop ( TDestination &  out,
abort_callback abort 
)
inline

Definition at line 147 of file ThreadUtils.h.

147  {
149  _Get(out);
150  }
void _Get(TDestination &out)
Definition: ThreadUtils.h:153
static void WaitAbortable_MsgLoop(HANDLE ev, abort_callback &abort)
Definition: ThreadUtils.h:29
HANDLE get() const
Definition: win-objects.h:131

Field Documentation

template<typename TWhat>
pfc::chain_list_v2_t<TWhat> ThreadUtils::CObjectQueue< TWhat >::m_content
private

Definition at line 163 of file ThreadUtils.h.

template<typename TWhat>
win32_event ThreadUtils::CObjectQueue< TWhat >::m_event
private

Definition at line 161 of file ThreadUtils.h.

template<typename TWhat>
critical_section ThreadUtils::CObjectQueue< TWhat >::m_sync
private

Definition at line 162 of file ThreadUtils.h.


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