Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
internal::node_cache< T, M > Class Template Reference

A node_cache maintains a std::queue of elements of type T. Each operation is protected by a lock. More...

#include <_flow_graph_cache_impl.h>

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

Public Types

typedef size_t size_type
 

Public Member Functions

bool empty ()
 
void add (T &n)
 
void remove (T &n)
 
void clear ()
 

Protected Types

typedef M mutex_type
 

Protected Member Functions

bool internal_empty ()
 
size_type internal_size ()
 
void internal_push (T &n)
 
T & internal_pop ()
 

Protected Attributes

mutex_type my_mutex
 
std::queue< T * > my_q
 

Detailed Description

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

A node_cache maintains a std::queue of elements of type T. Each operation is protected by a lock.

Definition at line 34 of file _flow_graph_cache_impl.h.

Member Typedef Documentation

◆ mutex_type

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

Definition at line 93 of file _flow_graph_cache_impl.h.

◆ size_type

template<typename T, typename M = spin_mutex>
typedef size_t internal::node_cache< T, M >::size_type

Definition at line 37 of file _flow_graph_cache_impl.h.

Member Function Documentation

◆ add()

template<typename T, typename M = spin_mutex>
void internal::node_cache< T, M >::add ( T &  n)
inline

Definition at line 44 of file _flow_graph_cache_impl.h.

44  {
45  typename mutex_type::scoped_lock lock( my_mutex );
46  internal_push(n);
47  }
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::predecessor_cache< input_type, null_mutex >::get_item(), internal::reserving_port< T >::handle_operations(), internal::function_input_base< Input, Policy, A, multifunction_input< Input, OutputPortSet, Policy, A > >::handle_operations(), and internal::reservable_predecessor_cache< T, null_mutex >::try_reserve().

Here is the caller graph for this function:

◆ clear()

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

Definition at line 58 of file _flow_graph_cache_impl.h.

58  {
59  while( !my_q.empty()) (void)my_q.pop();
60 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
61  my_built_predecessors.clear();
62 #endif
63  }

Referenced by internal::reservable_predecessor_cache< T, null_mutex >::clear(), tbb::flow::interface10::internal::join_node_FE< key_matching< K, KHash >, InputTuple, OutputTuple >::join_node_FE(), and internal::function_input_base< Input, Policy, A, multifunction_input< Input, OutputPortSet, Policy, A > >::reset_receiver().

Here is the caller graph for this function:

◆ empty()

template<typename T, typename M = spin_mutex>
bool internal::node_cache< T, M >::empty ( )
inline

Definition at line 39 of file _flow_graph_cache_impl.h.

39  {
40  typename mutex_type::scoped_lock lock( my_mutex );
41  return internal_empty();
42  }
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(), internal::function_input_base< Input, Policy, A, multifunction_input< Input, OutputPortSet, Policy, A > >::reset_receiver(), and internal::reserving_port< T >::reset_receiver().

Here is the caller graph for this function:

◆ internal_empty()

template<typename T, typename M = spin_mutex>
bool internal::node_cache< T, M >::internal_empty ( )
inlineprotected

Definition at line 101 of file _flow_graph_cache_impl.h.

101  {
102  return my_q.empty();
103  }

Referenced by internal::node_cache< sender< T >, M >::empty(), internal::predecessor_cache< input_type, null_mutex >::get_item(), internal::predecessor_cache< input_type, null_mutex >::reset(), and internal::reservable_predecessor_cache< T, null_mutex >::try_reserve().

Here is the caller graph for this function:

◆ internal_pop()

template<typename T, typename M = spin_mutex>
T& internal::node_cache< T, M >::internal_pop ( )
inlineprotected

Definition at line 116 of file _flow_graph_cache_impl.h.

116  {
117  T *v = my_q.front();
118  my_q.pop();
119  return *v;
120  }

Referenced by internal::predecessor_cache< input_type, null_mutex >::get_item(), internal::node_cache< sender< T >, M >::remove(), internal::predecessor_cache< input_type, null_mutex >::reset(), and internal::reservable_predecessor_cache< T, null_mutex >::try_reserve().

Here is the caller graph for this function:

◆ internal_push()

template<typename T, typename M = spin_mutex>
void internal::node_cache< T, M >::internal_push ( T &  n)
inlineprotected

Definition at line 111 of file _flow_graph_cache_impl.h.

111  {
112  my_q.push(&n);
113  }

Referenced by internal::node_cache< sender< T >, M >::add(), and internal::node_cache< sender< T >, M >::remove().

Here is the caller graph for this function:

◆ internal_size()

template<typename T, typename M = spin_mutex>
size_type internal::node_cache< T, M >::internal_size ( )
inlineprotected

Definition at line 106 of file _flow_graph_cache_impl.h.

106  {
107  return my_q.size();
108  }

Referenced by internal::node_cache< sender< T >, M >::remove().

Here is the caller graph for this function:

◆ remove()

template<typename T, typename M = spin_mutex>
void internal::node_cache< T, M >::remove ( T &  n)
inline

Definition at line 49 of file _flow_graph_cache_impl.h.

49  {
50  typename mutex_type::scoped_lock lock( my_mutex );
51  for ( size_t i = internal_size(); i != 0; --i ) {
52  T &s = internal_pop();
53  if ( &s == &n ) return; // only remove one predecessor per request
55  }
56  }
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
void const char const char int ITT_FORMAT __itt_group_sync s

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

Here is the caller graph for this function:

Member Data Documentation

◆ my_mutex

◆ my_q


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

Copyright © 2005-2019 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.