Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::flow::interface11::buffer_node< T, Allocator > Class Template Reference

Forwards messages in arbitrary order. More...

#include <flow_graph.h>

Inheritance diagram for tbb::flow::interface11::buffer_node< T, Allocator >:
Collaboration diagram for tbb::flow::interface11::buffer_node< T, Allocator >:

Classes

class  buffer_operation
 

Public Types

typedef T input_type
 
typedef T output_type
 
typedef receiver< input_type >::predecessor_type predecessor_type
 
typedef sender< output_type >::successor_type successor_type
 
typedef buffer_node< T, Allocator > class_type
 
- Public Types inherited from internal::item_buffer< T, cache_aligned_allocator< T > >
enum  buffer_item_state
 
typedef T item_type
 

Public Member Functions

 __TBB_STATIC_ASSERT ((tbb::internal::is_same_type< Allocator, null_type >::value), "Allocator template parameter for flow graph nodes is deprecated and will be removed. " "Specify TBB_DEPRECATED_FLOW_NODE_ALLOCATOR to temporary enable the deprecated interface.")
 
__TBB_NOINLINE_SYM buffer_node (graph &g)
 Constructor. More...
 
__TBB_NOINLINE_SYM buffer_node (const buffer_node &src)
 Copy constructor. More...
 
bool register_successor (successor_type &r) __TBB_override
 Adds a new successor. More...
 
bool remove_successor (successor_type &r) __TBB_override
 Removes a successor. More...
 
bool try_get (T &v) __TBB_override
 Request an item from the buffer_node. More...
 
bool try_reserve (T &v) __TBB_override
 Reserves an item. More...
 
bool try_release () __TBB_override
 Release a reserved item. More...
 
bool try_consume () __TBB_override
 Consumes a reserved item. More...
 
- Public Member Functions inherited from tbb::flow::interface11::graph_node
 graph_node (graph &g)
 
virtual ~graph_node ()
 
- Public Member Functions inherited from internal::reservable_item_buffer< T, cache_aligned_allocator< T > >
 reservable_item_buffer ()
 
void reset ()
 
- Public Member Functions inherited from internal::item_buffer< T, cache_aligned_allocator< T > >
 item_buffer ()
 Constructor. More...
 
 ~item_buffer ()
 
void reset ()
 
- Public Member Functions inherited from tbb::flow::interface11::receiver< T >
virtual ~receiver ()
 Destructor. More...
 
bool try_put (const T &t)
 Put an item to the receiver. More...
 
virtual __TBB_DEPRECATED bool register_predecessor (predecessor_type &)
 Add a predecessor to the node. More...
 
virtual __TBB_DEPRECATED bool remove_predecessor (predecessor_type &)
 Remove a predecessor from the node. More...
 
- Public Member Functions inherited from tbb::flow::interface11::sender< T >
virtual ~sender ()
 
virtual __TBB_DEPRECATED bool register_successor (successor_type &r)=0
 Add a new successor to this node. More...
 
virtual __TBB_DEPRECATED bool remove_successor (successor_type &r)=0
 Removes a successor from this node. More...
 

Protected Types

enum  op_type {
  reg_succ, rem_succ, req_item, res_item,
  rel_res, con_res, put_item, try_fwd_task
}
 
typedef size_t size_type
 
typedef internal::aggregating_functor< class_type, buffer_operationhandler_type
 
- Protected Types inherited from internal::item_buffer< T, cache_aligned_allocator< T > >
typedef size_t size_type
 
typedef aligned_pair< item_type, buffer_item_state >::type buffer_item_type
 
typedef tbb::internal::allocator_rebind< cache_aligned_allocator< T >, buffer_item_type >::type allocator_type
 

Protected Member Functions

virtual void handle_operations (buffer_operation *op_list)
 
template<typename derived_type >
void handle_operations_impl (buffer_operation *op_list, derived_type *derived)
 
taskgrab_forwarding_task (buffer_operation &op_data)
 
bool enqueue_forwarding_task (buffer_operation &op_data)
 
virtual taskforward_task ()
 This is executed by an enqueued task, the "forwarder". More...
 
virtual void internal_reg_succ (buffer_operation *op)
 Register successor. More...
 
virtual void internal_rem_succ (buffer_operation *op)
 Remove successor. More...
 
virtual void internal_forward_task (buffer_operation *op)
 Tries to forward valid items to successors. More...
 
template<typename derived_type >
void internal_forward_task_impl (buffer_operation *op, derived_type *derived)
 
virtual bool internal_push (buffer_operation *op)
 
virtual void internal_pop (buffer_operation *op)
 
virtual void internal_reserve (buffer_operation *op)
 
virtual void internal_consume (buffer_operation *op)
 
virtual void internal_release (buffer_operation *op)
 
tasktry_put_task (const T &t) __TBB_override
 receive an item, return a task *if possible More...
 
graphgraph_reference () const __TBB_override
 
void reset_receiver (reset_flags) __TBB_override
 put receiver back in initial state More...
 
void reset_node (reset_flags f) __TBB_override
 
- Protected Member Functions inherited from internal::reservable_item_buffer< T, cache_aligned_allocator< T > >
bool reserve_front (T &v)
 
void consume_front ()
 
void release_front ()
 
- Protected Member Functions inherited from internal::item_buffer< T, cache_aligned_allocator< T > >
bool buffer_empty () const
 
buffer_item_typeitem (size_type i)
 
const buffer_item_typeitem (size_type i) const
 
bool my_item_valid (size_type i) const
 
bool my_item_reserved (size_type i) const
 
const item_typeget_my_item (size_t i) const
 
void set_my_item (size_t i, const item_type &o)
 
void fetch_item (size_t i, item_type &o)
 
void move_item (size_t to, size_t from)
 
bool place_item (size_t here, const item_type &me)
 
void swap_items (size_t i, size_t j)
 
void destroy_item (size_type i)
 
const item_typefront () const
 
const item_typeback () const
 
void reserve_item (size_type i)
 
void release_item (size_type i)
 
void destroy_front ()
 
void destroy_back ()
 
size_type size (size_t new_tail=0)
 
size_type capacity ()
 
bool buffer_full ()
 
void grow_my_array (size_t minimum_size)
 Grows the internal array. More...
 
bool push_back (item_type &v)
 
bool pop_back (item_type &v)
 
bool pop_front (item_type &v)
 
void clean_up_buffer (bool reset_pointers)
 
- Protected Member Functions inherited from tbb::flow::interface11::receiver< T >
virtual bool is_continue_receiver ()
 

Protected Attributes

internal::round_robin_cache< T, null_rw_mutexmy_successors
 
bool forwarder_busy
 
internal::aggregator< handler_type, buffer_operationmy_aggregator
 
- Protected Attributes inherited from tbb::flow::interface11::graph_node
graphmy_graph
 
graph_nodenext
 
graph_nodeprev
 
- Protected Attributes inherited from internal::reservable_item_buffer< T, cache_aligned_allocator< T > >
bool my_reserved
 
- Protected Attributes inherited from internal::item_buffer< T, cache_aligned_allocator< T > >
buffer_item_typemy_array
 
size_type my_array_size
 
size_type my_head
 
size_type my_tail
 

Private Types

typedef cache_aligned_allocator< T > internals_allocator
 

Private Member Functions

void order ()
 
bool is_item_valid ()
 
void try_put_and_add_task (task *&last_task)
 

Friends

class internal::forward_task_bypass< class_type >
 
class internal::aggregating_functor< class_type, buffer_operation >
 
template<typename R , typename B >
class run_and_put_task
 
template<typename X , typename Y >
class internal::broadcast_cache
 
template<typename X , typename Y >
class internal::round_robin_cache
 

Additional Inherited Members

- Public Attributes inherited from tbb::flow::interface11::receiver< T >
__TBB_DEPRECATED typedef T input_type
 The input type of this receiver. More...
 
__TBB_DEPRECATED typedef sender< T > predecessor_type
 The predecessor type for this node. More...
 
- Public Attributes inherited from tbb::flow::interface11::sender< T >
__TBB_DEPRECATED typedef T output_type
 The output type of this sender. More...
 
__TBB_DEPRECATED typedef receiver< T > successor_type
 The successor type for this node. More...
 
- Static Protected Attributes inherited from internal::item_buffer< T, cache_aligned_allocator< T > >
static const size_type initial_buffer_size
 

Detailed Description

template<typename T, typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
class tbb::flow::interface11::buffer_node< T, Allocator >

Forwards messages in arbitrary order.

Definition at line 2036 of file flow_graph.h.

Member Typedef Documentation

◆ class_type

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
typedef buffer_node<T, Allocator> tbb::flow::interface11::buffer_node< T, Allocator >::class_type

Definition at line 2054 of file flow_graph.h.

◆ handler_type

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
typedef internal::aggregating_functor<class_type, buffer_operation> tbb::flow::interface11::buffer_node< T, Allocator >::handler_type
protected

Definition at line 2117 of file flow_graph.h.

◆ input_type

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
typedef T tbb::flow::interface11::buffer_node< T, Allocator >::input_type

Definition at line 2050 of file flow_graph.h.

◆ internals_allocator

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
typedef cache_aligned_allocator<T> tbb::flow::interface11::buffer_node< T, Allocator >::internals_allocator
private

Definition at line 2047 of file flow_graph.h.

◆ output_type

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
typedef T tbb::flow::interface11::buffer_node< T, Allocator >::output_type

Definition at line 2051 of file flow_graph.h.

◆ predecessor_type

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
typedef receiver<input_type>::predecessor_type tbb::flow::interface11::buffer_node< T, Allocator >::predecessor_type

Definition at line 2052 of file flow_graph.h.

◆ size_type

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
typedef size_t tbb::flow::interface11::buffer_node< T, Allocator >::size_type
protected

Definition at line 2068 of file flow_graph.h.

◆ successor_type

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
typedef sender<output_type>::successor_type tbb::flow::interface11::buffer_node< T, Allocator >::successor_type

Definition at line 2053 of file flow_graph.h.

Member Enumeration Documentation

◆ op_type

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
enum tbb::flow::interface11::buffer_node::op_type
protected
Enumerator
reg_succ 
rem_succ 
req_item 
res_item 
rel_res 
con_res 
put_item 
try_fwd_task 

Definition at line 2077 of file flow_graph.h.

2078 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
2079  , add_blt_succ, del_blt_succ,
2080  add_blt_pred, del_blt_pred,
2081  blt_succ_cnt, blt_pred_cnt,
2082  blt_succ_cpy, blt_pred_cpy // create vector copies of preds and succs
2083 #endif
2084  };

Constructor & Destructor Documentation

◆ buffer_node() [1/2]

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
__TBB_NOINLINE_SYM tbb::flow::interface11::buffer_node< T, Allocator >::buffer_node ( graph g)
inlineexplicit

Constructor.

Definition at line 2351 of file flow_graph.h.

2353  sender<T>(), forwarder_busy(false)
2354  {
2355  my_successors.set_owner(this);
2356  my_aggregator.initialize_handler(handler_type(this));
2357  tbb::internal::fgt_node( CODEPTR(), tbb::internal::FLOW_BUFFER_NODE, &this->my_graph,
2358  static_cast<receiver<input_type> *>(this), static_cast<sender<output_type> *>(this) );
2359  }

◆ buffer_node() [2/2]

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
__TBB_NOINLINE_SYM tbb::flow::interface11::buffer_node< T, Allocator >::buffer_node ( const buffer_node< T, Allocator > &  src)
inline

Copy constructor.

Definition at line 2369 of file flow_graph.h.

2371  receiver<T>(), sender<T>(), forwarder_busy(false)
2372  {
2373  my_successors.set_owner(this);
2374  my_aggregator.initialize_handler(handler_type(this));
2375  tbb::internal::fgt_node( CODEPTR(), tbb::internal::FLOW_BUFFER_NODE, &this->my_graph,
2376  static_cast<receiver<input_type> *>(this), static_cast<sender<output_type> *>(this) );
2377  }

Member Function Documentation

◆ __TBB_STATIC_ASSERT()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
tbb::flow::interface11::buffer_node< T, Allocator >::__TBB_STATIC_ASSERT ( (tbb::internal::is_same_type< Allocator, null_type >::value ,
"Allocator template parameter for flow graph nodes is deprecated and will be removed. " "Specify TBB_DEPRECATED_FLOW_NODE_ALLOCATOR to temporary enable the deprecated interface."   
)

◆ enqueue_forwarding_task()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
bool tbb::flow::interface11::buffer_node< T, Allocator >::enqueue_forwarding_task ( buffer_operation op_data)
inlineprotected

◆ forward_task()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual task* tbb::flow::interface11::buffer_node< T, Allocator >::forward_task ( )
inlineprotectedvirtual

This is executed by an enqueued task, the "forwarder".

Definition at line 2188 of file flow_graph.h.

2188  {
2189  buffer_operation op_data(try_fwd_task);
2190  task *last_task = NULL;
2191  do {
2192  op_data.status = internal::WAIT;
2193  op_data.ltask = NULL;
2194  my_aggregator.execute(&op_data);
2195 
2196  // workaround for icc bug
2197  tbb::task *xtask = op_data.ltask;
2198  graph& g = this->my_graph;
2199  last_task = combine_tasks(g, last_task, xtask);
2200  } while (op_data.status ==internal::SUCCEEDED);
2201  return last_task;
2202  }

◆ grab_forwarding_task()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
task* tbb::flow::interface11::buffer_node< T, Allocator >::grab_forwarding_task ( buffer_operation op_data)
inlineprotected

Definition at line 2174 of file flow_graph.h.

2174  {
2175  return op_data.ltask;
2176  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::enqueue_forwarding_task(), and tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::try_put_task().

Here is the caller graph for this function:

◆ graph_reference()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
graph& tbb::flow::interface11::buffer_node< T, Allocator >::graph_reference ( ) const
inlineprotectedvirtual

Implements tbb::flow::interface11::receiver< T >.

Definition at line 2530 of file flow_graph.h.

2530  {
2531  return my_graph;
2532  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::enqueue_forwarding_task(), and tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::try_put_task().

Here is the caller graph for this function:

◆ handle_operations()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual void tbb::flow::interface11::buffer_node< T, Allocator >::handle_operations ( buffer_operation op_list)
inlineprotectedvirtual

Definition at line 2121 of file flow_graph.h.

2121  {
2122  handle_operations_impl(op_list, this);
2123  }

◆ handle_operations_impl()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
template<typename derived_type >
void tbb::flow::interface11::buffer_node< T, Allocator >::handle_operations_impl ( buffer_operation op_list,
derived_type *  derived 
)
inlineprotected

Definition at line 2126 of file flow_graph.h.

2126  {
2127  __TBB_ASSERT(static_cast<class_type*>(derived) == this, "'this' is not a base class for derived");
2128 
2129  buffer_operation *tmp = NULL;
2130  bool try_forwarding = false;
2131  while (op_list) {
2132  tmp = op_list;
2133  op_list = op_list->next;
2134  switch (tmp->type) {
2135  case reg_succ: internal_reg_succ(tmp); try_forwarding = true; break;
2136  case rem_succ: internal_rem_succ(tmp); break;
2137  case req_item: internal_pop(tmp); break;
2138  case res_item: internal_reserve(tmp); break;
2139  case rel_res: internal_release(tmp); try_forwarding = true; break;
2140  case con_res: internal_consume(tmp); try_forwarding = true; break;
2141  case put_item: try_forwarding = internal_push(tmp); break;
2142  case try_fwd_task: internal_forward_task(tmp); break;
2143 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
2144  // edge recording
2145  case add_blt_succ: internal_add_built_succ(tmp); break;
2146  case del_blt_succ: internal_del_built_succ(tmp); break;
2147  case add_blt_pred: internal_add_built_pred(tmp); break;
2148  case del_blt_pred: internal_del_built_pred(tmp); break;
2149  case blt_succ_cnt: internal_succ_cnt(tmp); break;
2150  case blt_pred_cnt: internal_pred_cnt(tmp); break;
2151  case blt_succ_cpy: internal_copy_succs(tmp); break;
2152  case blt_pred_cpy: internal_copy_preds(tmp); break;
2153 #endif
2154  }
2155  }
2156 
2157  derived->order();
2158 
2159  if (try_forwarding && !forwarder_busy) {
2160  if(internal::is_graph_active(this->my_graph)) {
2161  forwarder_busy = true;
2162  task *new_task = new(task::allocate_additional_child_of(*(this->my_graph.root_task()))) internal::
2163  forward_task_bypass<class_type>(*this);
2164  // tmp should point to the last item handled by the aggregator. This is the operation
2165  // the handling thread enqueued. So modifying that record will be okay.
2166  // workaround for icc bug
2167  tbb::task *z = tmp->ltask;
2168  graph &g = this->my_graph;
2169  tmp->ltask = combine_tasks(g, z, new_task); // in case the op generated a task
2170  }
2171  }
2172  } // handle_operations

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::handle_operations().

Here is the caller graph for this function:

◆ internal_consume()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual void tbb::flow::interface11::buffer_node< T, Allocator >::internal_consume ( buffer_operation op)
inlineprotectedvirtual

Definition at line 2339 of file flow_graph.h.

2339  {
2340  this->consume_front();
2342  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::handle_operations_impl().

Here is the caller graph for this function:

◆ internal_forward_task()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual void tbb::flow::interface11::buffer_node< T, Allocator >::internal_forward_task ( buffer_operation op)
inlineprotectedvirtual

Tries to forward valid items to successors.

Definition at line 2286 of file flow_graph.h.

2286  {
2287  internal_forward_task_impl(op, this);
2288  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::handle_operations_impl().

Here is the caller graph for this function:

◆ internal_forward_task_impl()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
template<typename derived_type >
void tbb::flow::interface11::buffer_node< T, Allocator >::internal_forward_task_impl ( buffer_operation op,
derived_type *  derived 
)
inlineprotected

Definition at line 2291 of file flow_graph.h.

2291  {
2292  __TBB_ASSERT(static_cast<class_type*>(derived) == this, "'this' is not a base class for derived");
2293 
2294  if (this->my_reserved || !derived->is_item_valid()) {
2296  this->forwarder_busy = false;
2297  return;
2298  }
2299  // Try forwarding, giving each successor a chance
2300  task * last_task = NULL;
2301  size_type counter = my_successors.size();
2302  for (; counter > 0 && derived->is_item_valid(); --counter)
2303  derived->try_put_and_add_task(last_task);
2304 
2305  op->ltask = last_task; // return task
2306  if (last_task && !counter) {
2308  }
2309  else {
2311  forwarder_busy = false;
2312  }
2313  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::internal_forward_task().

Here is the caller graph for this function:

◆ internal_pop()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual void tbb::flow::interface11::buffer_node< T, Allocator >::internal_pop ( buffer_operation op)
inlineprotectedvirtual

Definition at line 2321 of file flow_graph.h.

2321  {
2322  if(this->pop_back(*(op->elem))) {
2324  }
2325  else {
2327  }
2328  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::handle_operations_impl().

Here is the caller graph for this function:

◆ internal_push()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual bool tbb::flow::interface11::buffer_node< T, Allocator >::internal_push ( buffer_operation op)
inlineprotectedvirtual

Definition at line 2315 of file flow_graph.h.

2315  {
2316  this->push_back(*(op->elem));
2318  return true;
2319  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::handle_operations_impl().

Here is the caller graph for this function:

◆ internal_reg_succ()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual void tbb::flow::interface11::buffer_node< T, Allocator >::internal_reg_succ ( buffer_operation op)
inlineprotectedvirtual

Register successor.

Definition at line 2205 of file flow_graph.h.

2205  {
2206  my_successors.register_successor(*(op->r));
2208  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::handle_operations_impl().

Here is the caller graph for this function:

◆ internal_release()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual void tbb::flow::interface11::buffer_node< T, Allocator >::internal_release ( buffer_operation op)
inlineprotectedvirtual

Definition at line 2344 of file flow_graph.h.

2344  {
2345  this->release_front();
2347  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::handle_operations_impl().

Here is the caller graph for this function:

◆ internal_rem_succ()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual void tbb::flow::interface11::buffer_node< T, Allocator >::internal_rem_succ ( buffer_operation op)
inlineprotectedvirtual

Remove successor.

Definition at line 2211 of file flow_graph.h.

2211  {
2212  my_successors.remove_successor(*(op->r));
2214  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::handle_operations_impl().

Here is the caller graph for this function:

◆ internal_reserve()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
virtual void tbb::flow::interface11::buffer_node< T, Allocator >::internal_reserve ( buffer_operation op)
inlineprotectedvirtual

Definition at line 2330 of file flow_graph.h.

2330  {
2331  if(this->reserve_front(*(op->elem))) {
2333  }
2334  else {
2336  }
2337  }

Referenced by tbb::flow::interface11::buffer_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::handle_operations_impl().

Here is the caller graph for this function:

◆ is_item_valid()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
bool tbb::flow::interface11::buffer_node< T, Allocator >::is_item_valid ( )
inlineprivate

Definition at line 2270 of file flow_graph.h.

2270  {
2271  return this->my_item_valid(this->my_tail - 1);
2272  }

◆ order()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
void tbb::flow::interface11::buffer_node< T, Allocator >::order ( )
inlineprivate

Definition at line 2268 of file flow_graph.h.

2268 {}

◆ register_successor()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
bool tbb::flow::interface11::buffer_node< T, Allocator >::register_successor ( successor_type r)
inline

Adds a new successor.

Adds successor r to the list of successors; may forward tasks.

Definition at line 2391 of file flow_graph.h.

2391  {
2392  buffer_operation op_data(reg_succ);
2393  op_data.r = &r;
2394  my_aggregator.execute(&op_data);
2395  (void)enqueue_forwarding_task(op_data);
2396  return true;
2397  }

◆ remove_successor()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
bool tbb::flow::interface11::buffer_node< T, Allocator >::remove_successor ( successor_type r)
inline

Removes a successor.

Removes successor r from the list of successors. It also calls r.remove_predecessor(*this) to remove this node as a predecessor.

Definition at line 2453 of file flow_graph.h.

2453  {
2454  r.remove_predecessor(*this);
2455  buffer_operation op_data(rem_succ);
2456  op_data.r = &r;
2457  my_aggregator.execute(&op_data);
2458  // even though this operation does not cause a forward, if we are the handler, and
2459  // a forward is scheduled, we may be the first to reach this point after the aggregator,
2460  // and so should check for the task.
2461  (void)enqueue_forwarding_task(op_data);
2462  return true;
2463  }

◆ reset_node()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
void tbb::flow::interface11::buffer_node< T, Allocator >::reset_node ( reset_flags  f)
inlineprotectedvirtual

Implements tbb::flow::interface11::graph_node.

Reimplemented in tbb::flow::interface11::queue_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >.

Definition at line 2545 of file flow_graph.h.

2545  {
2547  // TODO: just clear structures
2548  if (f&rf_clear_edges) {
2549  my_successors.clear();
2550 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
2551  my_built_predecessors.clear();
2552 #endif
2553  }
2554  forwarder_busy = false;
2555  }

Referenced by tbb::flow::interface11::queue_node< T, __TBB_DEFAULT_NODE_ALLOCATOR(T) >::reset_node(), and tbb::flow::interface11::priority_queue_node< T, Compare, Allocator >::reset_node().

Here is the caller graph for this function:

◆ reset_receiver()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
void tbb::flow::interface11::buffer_node< T, Allocator >::reset_receiver ( reset_flags  f)
inlineprotectedvirtual

put receiver back in initial state

Implements tbb::flow::interface11::receiver< T >.

Definition at line 2534 of file flow_graph.h.

2534 { }

◆ try_consume()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
bool tbb::flow::interface11::buffer_node< T, Allocator >::try_consume ( )
inlinevirtual

Consumes a reserved item.

true = item is removed from sender and reservation removed

Reimplemented from tbb::flow::interface11::sender< T >.

Definition at line 2498 of file flow_graph.h.

2498  {
2499  buffer_operation op_data(con_res);
2500  my_aggregator.execute(&op_data);
2501  (void)enqueue_forwarding_task(op_data);
2502  return true;
2503  }

◆ try_get()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
bool tbb::flow::interface11::buffer_node< T, Allocator >::try_get ( T &  v)
inlinevirtual

Request an item from the buffer_node.

true = v contains the returned item
false = no item has been returned

Reimplemented from tbb::flow::interface11::sender< T >.

Definition at line 2468 of file flow_graph.h.

2468  {
2469  buffer_operation op_data(req_item);
2470  op_data.elem = &v;
2471  my_aggregator.execute(&op_data);
2472  (void)enqueue_forwarding_task(op_data);
2473  return (op_data.status==internal::SUCCEEDED);
2474  }

◆ try_put_and_add_task()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
void tbb::flow::interface11::buffer_node< T, Allocator >::try_put_and_add_task ( task *&  last_task)
inlineprivate

Definition at line 2274 of file flow_graph.h.

2274  {
2275  task *new_task = my_successors.try_put_task(this->back());
2276  if (new_task) {
2277  // workaround for icc bug
2278  graph& g = this->my_graph;
2279  last_task = combine_tasks(g, last_task, new_task);
2280  this->destroy_back();
2281  }
2282  }

◆ try_put_task()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
task* tbb::flow::interface11::buffer_node< T, Allocator >::try_put_task ( const T &  t)
inlineprotectedvirtual

receive an item, return a task *if possible

Implements tbb::flow::interface11::receiver< T >.

Definition at line 2511 of file flow_graph.h.

2511  {
2512  buffer_operation op_data(t, put_item);
2513  my_aggregator.execute(&op_data);
2514  task *ft = grab_forwarding_task(op_data);
2515  // sequencer_nodes can return failure (if an item has been previously inserted)
2516  // We have to spawn the returned task if our own operation fails.
2517 
2518  if(ft && op_data.status ==internal::FAILED) {
2519  // we haven't succeeded queueing the item, but for some reason the
2520  // call returned a task (if another request resulted in a successful
2521  // forward this could happen.) Queue the task and reset the pointer.
2523  }
2524  else if(!ft && op_data.status ==internal::SUCCEEDED) {
2525  ft = SUCCESSFULLY_ENQUEUED;
2526  }
2527  return ft;
2528  }

◆ try_release()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
bool tbb::flow::interface11::buffer_node< T, Allocator >::try_release ( )
inlinevirtual

Release a reserved item.

true = item has been released and so remains in sender

Reimplemented from tbb::flow::interface11::sender< T >.

Definition at line 2489 of file flow_graph.h.

2489  {
2490  buffer_operation op_data(rel_res);
2491  my_aggregator.execute(&op_data);
2492  (void)enqueue_forwarding_task(op_data);
2493  return true;
2494  }

◆ try_reserve()

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
bool tbb::flow::interface11::buffer_node< T, Allocator >::try_reserve ( T &  v)
inlinevirtual

Reserves an item.

false = no item can be reserved
true = an item is reserved

Reimplemented from tbb::flow::interface11::sender< T >.

Definition at line 2479 of file flow_graph.h.

2479  {
2480  buffer_operation op_data(res_item);
2481  op_data.elem = &v;
2482  my_aggregator.execute(&op_data);
2483  (void)enqueue_forwarding_task(op_data);
2484  return (op_data.status==internal::SUCCEEDED);
2485  }

Friends And Related Function Documentation

◆ internal::aggregating_functor< class_type, buffer_operation >

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
friend class internal::aggregating_functor< class_type, buffer_operation >
friend

Definition at line 2118 of file flow_graph.h.

◆ internal::broadcast_cache

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
template<typename X , typename Y >
friend class internal::broadcast_cache
friend

Definition at line 2508 of file flow_graph.h.

◆ internal::forward_task_bypass< class_type >

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
friend class internal::forward_task_bypass< class_type >
friend

Definition at line 2075 of file flow_graph.h.

◆ internal::round_robin_cache

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
template<typename X , typename Y >
friend class internal::round_robin_cache
friend

Definition at line 2509 of file flow_graph.h.

◆ run_and_put_task

template<typename T , typename Allocator = __TBB_DEFAULT_NODE_ALLOCATOR(T)>
template<typename R , typename B >
friend class run_and_put_task
friend

Definition at line 2507 of file flow_graph.h.

Member Data Documentation

◆ forwarder_busy

◆ my_aggregator

◆ my_successors


The documentation for this class was generated from the following file:
tbb::flow::interface11::buffer_node::my_aggregator
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:2119
tbb::flow::interface11::buffer_node::my_successors
internal::round_robin_cache< T, null_rw_mutex > my_successors
Definition: flow_graph.h:2069
internal::item_buffer< T, cache_aligned_allocator< T > >::push_back
bool push_back(item_type &v)
Definition: _flow_graph_item_buffer_impl.h:185
internal::item_buffer< T, cache_aligned_allocator< T > >::my_item_valid
bool my_item_valid(size_type i) const
Definition: _flow_graph_item_buffer_impl.h:68
internal::reservable_item_buffer< T, cache_aligned_allocator< T > >::reserve_front
bool reserve_front(T &v)
Definition: _flow_graph_item_buffer_impl.h:257
internal::SUCCEEDED
@ SUCCEEDED
Definition: _flow_graph_types_impl.h:719
void
void
Definition: ittnotify_static.h:91
tbb::flow::interface11::buffer_node::grab_forwarding_task
task * grab_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:2174
tbb::flow::interface11::buffer_node::rem_succ
@ rem_succ
Definition: flow_graph.h:2077
tbb::flow::interface11::internal::is_graph_active
bool is_graph_active(tbb::flow::interface10::graph &g)
Definition: _flow_graph_impl.h:494
tbb::flow::interface11::internal::spawn_in_graph_arena
void spawn_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
Definition: _flow_graph_impl.h:521
tbb::flow::interface11::buffer_node::internal_release
virtual void internal_release(buffer_operation *op)
Definition: flow_graph.h:2344
CODEPTR
#define CODEPTR()
Definition: _flow_graph_trace_impl.h:297
tbb::flow::interface11::buffer_node::handle_operations_impl
void handle_operations_impl(buffer_operation *op_list, derived_type *derived)
Definition: flow_graph.h:2126
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::flow::interface11::graph_node::my_graph
graph & my_graph
Definition: _flow_graph_impl.h:464
tbb::flow::interface11::buffer_node::handler_type
internal::aggregating_functor< class_type, buffer_operation > handler_type
Definition: flow_graph.h:2117
internal::reservable_item_buffer< T, cache_aligned_allocator< T > >::consume_front
void consume_front()
Definition: _flow_graph_item_buffer_impl.h:266
tbb::flow::interface11::buffer_node::con_res
@ con_res
Definition: flow_graph.h:2077
tbb::flow::interface11::combine_tasks
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
Definition: flow_graph.h:198
tbb::flow::interface10::graph::root_task
tbb::task * root_task()
Returns the root task of the graph.
Definition: _flow_graph_impl.h:374
tbb::task
Base class for user-defined tasks.
Definition: task.h:615
tbb::flow::interface11::buffer_node::internal_rem_succ
virtual void internal_rem_succ(buffer_operation *op)
Remove successor.
Definition: flow_graph.h:2211
internal::reservable_item_buffer
item_buffer with reservable front-end. NOTE: if reserving, do not
Definition: _flow_graph_item_buffer_impl.h:247
tbb::flow::interface11::buffer_node::internal_reserve
virtual void internal_reserve(buffer_operation *op)
Definition: flow_graph.h:2330
tbb::flow::interface11::buffer_node::rel_res
@ rel_res
Definition: flow_graph.h:2077
tbb::flow::internal::SUCCESSFULLY_ENQUEUED
static tbb::task *const SUCCESSFULLY_ENQUEUED
Definition: _flow_graph_impl.h:61
internal::item_buffer< T, cache_aligned_allocator< T > >::my_tail
size_type my_tail
Definition: _flow_graph_item_buffer_impl.h:52
tbb::flow::interface11::buffer_node::internal_reg_succ
virtual void internal_reg_succ(buffer_operation *op)
Register successor.
Definition: flow_graph.h:2205
tbb::flow::interface11::buffer_node::forwarder_busy
bool forwarder_busy
Definition: flow_graph.h:2116
internal::item_buffer< T, cache_aligned_allocator< T > >::destroy_back
void destroy_back()
Definition: _flow_graph_item_buffer_impl.h:147
tbb::flow::interface11::buffer_node::internal_push
virtual bool internal_push(buffer_operation *op)
Definition: flow_graph.h:2315
tbb::flow::interface11::buffer_node::reg_succ
@ reg_succ
Definition: flow_graph.h:2077
internal::item_buffer< T, cache_aligned_allocator< T > >::pop_back
bool pop_back(item_type &v)
Definition: _flow_graph_item_buffer_impl.h:194
tbb::internal::__TBB_store_with_release
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:713
tbb::flow::interface11::buffer_node::internal_forward_task_impl
void internal_forward_task_impl(buffer_operation *op, derived_type *derived)
Definition: flow_graph.h:2291
tbb::flow::interface11::buffer_node::put_item
@ put_item
Definition: flow_graph.h:2077
internal::WAIT
@ WAIT
Definition: _flow_graph_types_impl.h:719
tbb::flow::interface11::buffer_node::graph_reference
graph & graph_reference() const __TBB_override
Definition: flow_graph.h:2530
tbb::flow::interface11::buffer_node::internal_consume
virtual void internal_consume(buffer_operation *op)
Definition: flow_graph.h:2339
tbb::flow::interface11::buffer_node::size_type
size_t size_type
Definition: flow_graph.h:2068
internal::reservable_item_buffer< T, cache_aligned_allocator< T > >::release_front
void release_front()
Definition: _flow_graph_item_buffer_impl.h:272
task
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 * task
Definition: ittnotify_static.h:119
tbb::flow::interface11::graph_node::graph_node
graph_node(graph &g)
Definition: flow_graph.h:887
tbb::flow::interface11::buffer_node::res_item
@ res_item
Definition: flow_graph.h:2077
tbb::flow::interface11::rf_clear_edges
@ rf_clear_edges
Definition: _flow_graph_impl.h:161
tbb::flow::interface11::buffer_node::internal_pop
virtual void internal_pop(buffer_operation *op)
Definition: flow_graph.h:2321
internal::FAILED
@ FAILED
Definition: _flow_graph_types_impl.h:719
tbb::internal::fgt_node
static void fgt_node(void *, string_index, void *, void *)
Definition: _flow_graph_trace_impl.h:326
tbb::flow::interface11::buffer_node::class_type
buffer_node< T, Allocator > class_type
Definition: flow_graph.h:2054
tbb::flow::interface11::buffer_node::internal_forward_task
virtual void internal_forward_task(buffer_operation *op)
Tries to forward valid items to successors.
Definition: flow_graph.h:2286
internal::item_buffer< T, cache_aligned_allocator< T > >::back
const item_type & back() const
Definition: _flow_graph_item_buffer_impl.h:136
tbb::flow::interface11::buffer_node::try_fwd_task
@ try_fwd_task
Definition: flow_graph.h:2077
internal::reservable_item_buffer::reset
void reset()
Definition: _flow_graph_item_buffer_impl.h:254
internal::reservable_item_buffer< T, cache_aligned_allocator< T > >::my_reserved
bool my_reserved
Definition: _flow_graph_item_buffer_impl.h:278
tbb::flow::interface11::graph_node::graph
friend class graph
Definition: _flow_graph_impl.h:455
tbb::flow::interface11::buffer_node::req_item
@ req_item
Definition: flow_graph.h:2077
tbb::flow::interface11::buffer_node::enqueue_forwarding_task
bool enqueue_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:2178

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.