Home ⌂Doc Index ◂Up ▴
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 30 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 89 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 33 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 40 of file _flow_graph_cache_impl.h.

40  {
41  typename mutex_type::scoped_lock lock( my_mutex );
42  internal_push(n);
43  }
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(), and internal::function_input_base< Input, Policy, A, multifunction_input< Input, OutputPortSet, Policy, A > >::handle_operations().

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 54 of file _flow_graph_cache_impl.h.

54  {
55  while( !my_q.empty()) (void)my_q.pop();
56 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
57  my_built_predecessors.clear();
58 #endif
59  }

Referenced by internal::function_input_base< Input, Policy, A, multifunction_input< Input, OutputPortSet, Policy, A > >::reset_receiver(), and tbb::flow::interface11::internal::unfolded_join_node< 2, key_matching_port, OutputTuple, key_matching< K, KHash > >::unfolded_join_node().

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 35 of file _flow_graph_cache_impl.h.

35  {
36  typename mutex_type::scoped_lock lock( my_mutex );
37  return internal_empty();
38  }
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 97 of file _flow_graph_cache_impl.h.

97  {
98  return my_q.empty();
99  }

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

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 112 of file _flow_graph_cache_impl.h.

112  {
113  T *v = my_q.front();
114  my_q.pop();
115  return *v;
116  }

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

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 107 of file _flow_graph_cache_impl.h.

107  {
108  my_q.push(&n);
109  }

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 102 of file _flow_graph_cache_impl.h.

102  {
103  return my_q.size();
104  }

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 45 of file _flow_graph_cache_impl.h.

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

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

◆ my_q


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.