Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
internal::predecessor_cache< T, M > Class Template Reference

A cache of predecessors that only supports try_get. More...

#include <_flow_graph_cache_impl.h>

Inheritance diagram for internal::predecessor_cache< T, M >:
Collaboration diagram for internal::predecessor_cache< T, M >:

Public Types

typedef M mutex_type
 
typedef T output_type
 
typedef sender< output_typepredecessor_type
 
typedef receiver< output_typesuccessor_type
 
- Public Types inherited from internal::node_cache< sender< T >, M >
typedef size_t size_type
 

Public Member Functions

 predecessor_cache ()
 
void set_owner (successor_type *owner)
 
bool get_item (output_type &v)
 
void reset ()
 
- Public Member Functions inherited from internal::node_cache< sender< T >, M >
bool empty ()
 
void add (sender< T > &n)
 
void remove (sender< T > &n)
 
void clear ()
 

Protected Attributes

successor_typemy_owner
 
- Protected Attributes inherited from internal::node_cache< sender< T >, M >
mutex_type my_mutex
 
std::queue< sender< T > * > my_q
 

Additional Inherited Members

- Protected Types inherited from internal::node_cache< sender< T >, M >
typedef M mutex_type
 
- Protected Member Functions inherited from internal::node_cache< sender< T >, M >
bool internal_empty ()
 
size_type internal_size ()
 
void internal_push (sender< T > &n)
 
sender< T > & internal_pop ()
 

Detailed Description

template<typename T, typename M = spin_mutex>
class internal::predecessor_cache< T, M >

A cache of predecessors that only supports try_get.

Definition at line 126 of file _flow_graph_cache_impl.h.

Member Typedef Documentation

◆ mutex_type

template<typename T, typename M = spin_mutex>
typedef M internal::predecessor_cache< T, M >::mutex_type

Definition at line 129 of file _flow_graph_cache_impl.h.

◆ output_type

template<typename T, typename M = spin_mutex>
typedef T internal::predecessor_cache< T, M >::output_type

Definition at line 130 of file _flow_graph_cache_impl.h.

◆ predecessor_type

template<typename T, typename M = spin_mutex>
typedef sender<output_type> internal::predecessor_cache< T, M >::predecessor_type

Definition at line 135 of file _flow_graph_cache_impl.h.

◆ successor_type

template<typename T, typename M = spin_mutex>
typedef receiver<output_type> internal::predecessor_cache< T, M >::successor_type

Definition at line 136 of file _flow_graph_cache_impl.h.

Constructor & Destructor Documentation

◆ predecessor_cache()

template<typename T, typename M = spin_mutex>
internal::predecessor_cache< T, M >::predecessor_cache ( )
inline

Definition at line 139 of file _flow_graph_cache_impl.h.

139 : my_owner( NULL ) { }

Member Function Documentation

◆ get_item()

template<typename T, typename M = spin_mutex>
bool internal::predecessor_cache< T, M >::get_item ( output_type v)
inline

Definition at line 143 of file _flow_graph_cache_impl.h.

143  {
144 
145  bool msg = false;
146 
147  do {
148  predecessor_type *src;
149  {
150  typename mutex_type::scoped_lock lock(this->my_mutex);
151  if ( this->internal_empty() ) {
152  break;
153  }
154  src = &this->internal_pop();
155  }
156 
157  // Try to get from this sender
158  msg = src->try_get( v );
159 
160  if (msg == false) {
161  // Relinquish ownership of the edge
162  if (my_owner)
163  src->register_successor( *my_owner );
164  } else {
165  // Retain ownership of the edge
166  this->add(*src);
167  }
168  } while ( msg == false );
169  return msg;
170  }
sender< output_type > predecessor_type
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock

Referenced by internal::function_input_base< Input, Policy, A, multifunction_input< Input, OutputPortSet, Policy, A > >::perform_queued_requests().

Here is the caller graph for this function:

◆ reset()

template<typename T, typename M = spin_mutex>
void internal::predecessor_cache< T, M >::reset ( )
inline

Definition at line 173 of file _flow_graph_cache_impl.h.

173  {
174  if (my_owner) {
175  for(;;) {
176  predecessor_type *src;
177  {
178  if (this->internal_empty()) break;
179  src = &this->internal_pop();
180  }
181  src->register_successor( *my_owner );
182  }
183  }
184  }
sender< output_type > predecessor_type

Referenced by internal::reservable_predecessor_cache< T, null_mutex >::reset(), and internal::function_input_base< Input, Policy, A, multifunction_input< Input, OutputPortSet, Policy, A > >::reset_receiver().

Here is the caller graph for this function:

◆ set_owner()

template<typename T, typename M = spin_mutex>
void internal::predecessor_cache< T, M >::set_owner ( successor_type owner)
inline

Definition at line 141 of file _flow_graph_cache_impl.h.

141 { my_owner = owner; }

Referenced by internal::function_input_base< Input, Policy, A, multifunction_input< Input, OutputPortSet, Policy, A > >::function_input_base(), and internal::reserving_port< T >::reserving_port().

Here is the caller graph for this function:

Member Data Documentation

◆ my_owner


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

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.