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

◆ 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 tbb::flow::interface11::function_node< Input, Output, Policy, Allocator >::reset_node(), and internal::function_input_base< Input, queueing_lightweight, cache_aligned_allocator< Input >, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, queueing_lightweight, cache_aligned_allocator< Input > > >::reset_receiver().

Here is the caller graph for this function:

◆ empty()

◆ 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 >, spin_mutex >::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 >, spin_mutex >::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 >, spin_mutex >::add(), and internal::node_cache< sender< T >, spin_mutex >::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 >, spin_mutex >::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  }

Referenced by internal::reserving_port< T >::handle_operations(), and internal::function_input_base< Input, queueing_lightweight, cache_aligned_allocator< Input >, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< tuple< Output > >::value, internal::multifunction_output, tuple< Output > >::type, queueing_lightweight, cache_aligned_allocator< Input > > >::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:
void
void
Definition: ittnotify_static.h:91
internal::node_cache::my_mutex
mutex_type my_mutex
Definition: _flow_graph_cache_impl.h:90
internal::node_cache::internal_empty
bool internal_empty()
Definition: _flow_graph_cache_impl.h:97
internal::node_cache::internal_size
size_type internal_size()
Definition: _flow_graph_cache_impl.h:102
internal::node_cache::my_q
std::queue< T * > my_q
Definition: _flow_graph_cache_impl.h:91
lock
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
Definition: ittnotify_static.h:121
internal::node_cache::internal_pop
T & internal_pop()
Definition: _flow_graph_cache_impl.h:112
s
void const char const char int ITT_FORMAT __itt_group_sync s
Definition: ittnotify_static.h:91
internal::node_cache::internal_push
void internal_push(T &n)
Definition: _flow_graph_cache_impl.h:107

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.