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

An cache of predecessors that supports requests and reservations. More...

#include <_flow_graph_cache_impl.h>

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

Public Types

typedef M mutex_type
 
typedef T output_type
 
typedef sender< T > predecessor_type
 
typedef receiver< T > successor_type
 
- Public Types inherited from internal::predecessor_cache< T, M >
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

 reservable_predecessor_cache ()
 
bool try_reserve (output_type &v)
 
bool try_release ()
 
bool try_consume ()
 
void reset ()
 
void clear ()
 
- Public Member Functions inherited from internal::predecessor_cache< T, M >
 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 ()
 

Private Attributes

predecessor_typereserved_src
 

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 ()
 
- Protected Attributes inherited from internal::predecessor_cache< T, M >
successor_typemy_owner
 
- Protected Attributes inherited from internal::node_cache< sender< T >, M >
mutex_type my_mutex
 
std::queue< sender< T > * > my_q
 

Detailed Description

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

An cache of predecessors that supports requests and reservations.

Definition at line 197 of file _flow_graph_cache_impl.h.

Member Typedef Documentation

◆ mutex_type

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

Definition at line 199 of file _flow_graph_cache_impl.h.

◆ output_type

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

Definition at line 200 of file _flow_graph_cache_impl.h.

◆ predecessor_type

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

Definition at line 205 of file _flow_graph_cache_impl.h.

◆ successor_type

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

Definition at line 206 of file _flow_graph_cache_impl.h.

Constructor & Destructor Documentation

◆ reservable_predecessor_cache()

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

Definition at line 209 of file _flow_graph_cache_impl.h.

209 : reserved_src(NULL) { }

Member Function Documentation

◆ clear()

template<typename T, typename M = spin_mutex>
void internal::reservable_predecessor_cache< T, M >::clear ( )
inline

Definition at line 260 of file _flow_graph_cache_impl.h.

Referenced by internal::reserving_port< T >::reset_receiver().

Here is the caller graph for this function:

◆ reset()

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

Definition at line 255 of file _flow_graph_cache_impl.h.

Referenced by internal::reserving_port< T >::reset_receiver().

Here is the caller graph for this function:

◆ try_consume()

template<typename T, typename M = spin_mutex>
bool internal::reservable_predecessor_cache< T, M >::try_consume ( )
inline

Definition at line 249 of file _flow_graph_cache_impl.h.

249  {
250  reserved_src->try_consume( );
251  reserved_src = NULL;
252  return true;
253  }

Referenced by internal::reserving_port< T >::handle_operations().

Here is the caller graph for this function:

◆ try_release()

template<typename T, typename M = spin_mutex>
bool internal::reservable_predecessor_cache< T, M >::try_release ( )
inline

Definition at line 242 of file _flow_graph_cache_impl.h.

242  {
243  reserved_src->try_release( );
244  reserved_src = NULL;
245  return true;
246  }

Referenced by internal::reserving_port< T >::handle_operations().

Here is the caller graph for this function:

◆ try_reserve()

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

Definition at line 212 of file _flow_graph_cache_impl.h.

212  {
213  bool msg = false;
214 
215  do {
216  {
217  typename mutex_type::scoped_lock lock(this->my_mutex);
218  if ( reserved_src || this->internal_empty() )
219  return false;
220 
221  reserved_src = &this->internal_pop();
222  }
223 
224  // Try to get from this sender
225  msg = reserved_src->try_reserve( v );
226 
227  if (msg == false) {
228  typename mutex_type::scoped_lock lock(this->my_mutex);
229  // Relinquish ownership of the edge
230  reserved_src->register_successor( *this->my_owner );
231  reserved_src = NULL;
232  } else {
233  // Retain ownership of the edge
234  this->add( *reserved_src );
235  }
236  } while ( msg == false );
237 
238  return msg;
239  }
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::reserving_port< T >::handle_operations().

Here is the caller graph for this function:

Member Data Documentation

◆ reserved_src

template<typename T, typename M = spin_mutex>
predecessor_type* internal::reservable_predecessor_cache< T, M >::reserved_src
private

Definition at line 266 of file _flow_graph_cache_impl.h.


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.