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

Forwards messages in arbitrary order. More...

#include <flow_graph.h>

Inheritance diagram for tbb::flow::interface10::buffer_node< T, A >:
Collaboration diagram for tbb::flow::interface10::buffer_node< T, A >:

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, A > class_type
 
- Public Types inherited from tbb::flow::interface10::internal::item_buffer< T, A >
enum  buffer_item_state { no_item =0, has_item =1, reserved_item =2 }
 
typedef T item_type
 
- Public Types inherited from tbb::flow::interface10::receiver< T >
typedef T input_type
 The input type of this receiver. More...
 
typedef internal::async_helpers< T >::filtered_type filtered_type
 
- Public Types inherited from tbb::flow::interface10::internal::untyped_receiver
typedef untyped_sender predecessor_type
 The predecessor type for this node. More...
 
- Public Types inherited from tbb::flow::interface10::sender< T >
typedef T output_type
 The output type of this sender. More...
 
typedef internal::async_helpers< T >::filtered_type filtered_type
 
- Public Types inherited from tbb::flow::interface10::internal::untyped_sender
typedef untyped_receiver successor_type
 The successor type for this node. More...
 

Public Member Functions

 buffer_node (graph &g)
 Constructor. More...
 
 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::interface10::graph_node
 graph_node (graph &g)
 
virtual ~graph_node ()
 
- Public Member Functions inherited from tbb::flow::interface10::internal::reservable_item_buffer< T, A >
 reservable_item_buffer ()
 
void reset ()
 
- Public Member Functions inherited from tbb::flow::interface10::internal::item_buffer< T, A >
 item_buffer ()
 Constructor. More...
 
 ~item_buffer ()
 
void reset ()
 
- Public Member Functions inherited from tbb::flow::interface10::receiver< T >
bool try_put (const typename internal::async_helpers< T >::filtered_type &t)
 Put an item to the receiver. More...
 
bool try_put (const typename internal::async_helpers< T >::async_type &t)
 
- Public Member Functions inherited from tbb::flow::interface10::internal::untyped_receiver
virtual ~untyped_receiver ()
 Destructor. More...
 
template<typename X >
bool try_put (const X &t)
 Put an item to the receiver. More...
 
virtual bool register_predecessor (predecessor_type &)
 Add a predecessor to the node. More...
 
virtual bool remove_predecessor (predecessor_type &)
 Remove a predecessor from the node. More...
 
- Public Member Functions inherited from tbb::flow::interface10::internal::untyped_sender
virtual ~untyped_sender ()
 

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 tbb::flow::interface10::internal::item_buffer< T, A >
typedef size_t size_type
 
typedef aligned_pair< item_type, buffer_item_state >::type buffer_item_type
 
typedef A::template rebind< buffer_item_type >::other 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 () __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 tbb::flow::interface10::internal::reservable_item_buffer< T, A >
bool reserve_front (T &v)
 
void consume_front ()
 
void release_front ()
 
- Protected Member Functions inherited from tbb::flow::interface10::internal::item_buffer< T, A >
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::interface10::receiver< T >
virtual tasktry_put_task_wrapper (const void *p, bool is_async) __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface10::internal::untyped_receiver
template<typename X >
tasktry_put_task (const X &t)
 
virtual bool is_continue_receiver ()
 
- Protected Member Functions inherited from tbb::flow::interface10::sender< T >
virtual bool try_get_wrapper (void *p, bool is_async) __TBB_override
 
virtual bool try_reserve_wrapper (void *p, bool is_async) __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface10::internal::untyped_sender
template<typename X >
bool try_get (X &t)
 Request an item from the sender. More...
 
template<typename X >
bool try_reserve (X &t)
 Reserves an item in the sender. More...
 

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::interface10::graph_node
graphmy_graph
 
graph_nodenext
 
graph_nodeprev
 
- Protected Attributes inherited from tbb::flow::interface10::internal::reservable_item_buffer< T, A >
bool my_reserved
 
- Protected Attributes inherited from tbb::flow::interface10::internal::item_buffer< T, A >
buffer_item_typemy_array
 
size_type my_array_size
 
size_type my_head
 
size_type my_tail
 

Private Member Functions

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

Friends

class internal::forward_task_bypass< buffer_node< T, A > >
 
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

- Static Protected Attributes inherited from tbb::flow::interface10::internal::item_buffer< T, A >
static const size_type initial_buffer_size = 4
 

Detailed Description

template<typename T, typename A = cache_aligned_allocator<T>>
class tbb::flow::interface10::buffer_node< T, A >

Forwards messages in arbitrary order.

Definition at line 1541 of file flow_graph.h.

Member Typedef Documentation

◆ class_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef buffer_node<T, A> tbb::flow::interface10::buffer_node< T, A >::class_type

Definition at line 1547 of file flow_graph.h.

◆ handler_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef internal::aggregating_functor<class_type, buffer_operation> tbb::flow::interface10::buffer_node< T, A >::handler_type
protected

Definition at line 1602 of file flow_graph.h.

◆ input_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef T tbb::flow::interface10::buffer_node< T, A >::input_type

Definition at line 1543 of file flow_graph.h.

◆ output_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef T tbb::flow::interface10::buffer_node< T, A >::output_type

Definition at line 1544 of file flow_graph.h.

◆ predecessor_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef receiver<input_type>::predecessor_type tbb::flow::interface10::buffer_node< T, A >::predecessor_type

Definition at line 1545 of file flow_graph.h.

◆ size_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef size_t tbb::flow::interface10::buffer_node< T, A >::size_type
protected

Definition at line 1553 of file flow_graph.h.

◆ successor_type

template<typename T, typename A = cache_aligned_allocator<T>>
typedef sender<output_type>::successor_type tbb::flow::interface10::buffer_node< T, A >::successor_type

Definition at line 1546 of file flow_graph.h.

Member Enumeration Documentation

◆ op_type

template<typename T, typename A = cache_aligned_allocator<T>>
enum tbb::flow::interface10::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 1562 of file flow_graph.h.

1563 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
1564  , add_blt_succ, del_blt_succ,
1565  add_blt_pred, del_blt_pred,
1566  blt_succ_cnt, blt_pred_cnt,
1567  blt_succ_cpy, blt_pred_cpy // create vector copies of preds and succs
1568 #endif
1569  };

Constructor & Destructor Documentation

◆ buffer_node() [1/2]

template<typename T, typename A = cache_aligned_allocator<T>>
tbb::flow::interface10::buffer_node< T, A >::buffer_node ( graph g)
inlineexplicit

Constructor.

Definition at line 1837 of file flow_graph.h.

1838  forwarder_busy(false) {
1839  my_successors.set_owner(this);
1840  my_aggregator.initialize_handler(handler_type(this));
1841  tbb::internal::fgt_node( tbb::internal::FLOW_BUFFER_NODE, &this->my_graph,
1842  static_cast<receiver<input_type> *>(this), static_cast<sender<output_type> *>(this) );
1843  }
internal::aggregating_functor< class_type, buffer_operation > handler_type
Definition: flow_graph.h:1602
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604
static void fgt_node(string_index, void *, void *)
internal::round_robin_cache< T, null_rw_mutex > my_successors
Definition: flow_graph.h:1554
item_buffer with reservable front-end. NOTE: if reserving, do not

◆ buffer_node() [2/2]

template<typename T, typename A = cache_aligned_allocator<T>>
tbb::flow::interface10::buffer_node< T, A >::buffer_node ( const buffer_node< T, A > &  src)
inline

Copy constructor.

Definition at line 1846 of file flow_graph.h.

1846  : graph_node(src.my_graph),
1847  internal::reservable_item_buffer<T>(), receiver<T>(), sender<T>() {
1848  forwarder_busy = false;
1849  my_successors.set_owner(this);
1850  my_aggregator.initialize_handler(handler_type(this));
1851  tbb::internal::fgt_node( tbb::internal::FLOW_BUFFER_NODE, &this->my_graph,
1852  static_cast<receiver<input_type> *>(this), static_cast<sender<output_type> *>(this) );
1853  }
internal::aggregating_functor< class_type, buffer_operation > handler_type
Definition: flow_graph.h:1602
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604
static void fgt_node(string_index, void *, void *)
internal::round_robin_cache< T, null_rw_mutex > my_successors
Definition: flow_graph.h:1554
item_buffer with reservable front-end. NOTE: if reserving, do not

References tbb::flow::interface10::internal::successor_cache< T, M >::set_owner().

Here is the call graph for this function:

Member Function Documentation

◆ enqueue_forwarding_task()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::buffer_node< T, A >::enqueue_forwarding_task ( buffer_operation op_data)
inlineprotected

Definition at line 1664 of file flow_graph.h.

1664  {
1665  task *ft = grab_forwarding_task(op_data);
1666  if(ft) {
1668  return true;
1669  }
1670  return false;
1671  }
void spawn_in_graph_arena(graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
graph & graph_reference() __TBB_override
Definition: flow_graph.h:2006
task * grab_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:1660
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

References tbb::flow::interface10::internal::spawn_in_graph_arena().

Here is the call graph for this function:

◆ forward_task()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual task* tbb::flow::interface10::buffer_node< T, A >::forward_task ( )
inlineprotectedvirtual

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

Definition at line 1674 of file flow_graph.h.

1674  {
1675  buffer_operation op_data(try_fwd_task);
1676  task *last_task = NULL;
1677  do {
1678  op_data.status = internal::WAIT;
1679  op_data.ltask = NULL;
1680  my_aggregator.execute(&op_data);
1681 
1682  // workaround for icc bug
1683  tbb::task *xtask = op_data.ltask;
1684  graph& g = this->my_graph;
1685  last_task = combine_tasks(g, last_task, xtask);
1686  } while (op_data.status ==internal::SUCCEEDED);
1687  return last_task;
1688  }
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604
Base class for user-defined tasks.
Definition: task.h:589
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
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
Definition: flow_graph.h:171

◆ grab_forwarding_task()

template<typename T, typename A = cache_aligned_allocator<T>>
task* tbb::flow::interface10::buffer_node< T, A >::grab_forwarding_task ( buffer_operation op_data)
inlineprotected

Definition at line 1660 of file flow_graph.h.

1660  {
1661  return op_data.ltask;
1662  }

◆ graph_reference()

template<typename T, typename A = cache_aligned_allocator<T>>
graph& tbb::flow::interface10::buffer_node< T, A >::graph_reference ( )
inlineprotectedvirtual

Implements tbb::flow::interface10::internal::untyped_receiver.

Definition at line 2006 of file flow_graph.h.

2006  {
2007  return my_graph;
2008  }

◆ handle_operations()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual void tbb::flow::interface10::buffer_node< T, A >::handle_operations ( buffer_operation op_list)
inlineprotectedvirtual

Reimplemented in tbb::flow::interface10::priority_queue_node< T, Compare, A >.

Definition at line 1606 of file flow_graph.h.

1606  {
1607  handle_operations_impl(op_list, this);
1608  }
void handle_operations_impl(buffer_operation *op_list, derived_type *derived)
Definition: flow_graph.h:1611

◆ handle_operations_impl()

template<typename T, typename A = cache_aligned_allocator<T>>
template<typename derived_type >
void tbb::flow::interface10::buffer_node< T, A >::handle_operations_impl ( buffer_operation op_list,
derived_type *  derived 
)
inlineprotected

Definition at line 1611 of file flow_graph.h.

1611  {
1612  __TBB_ASSERT(static_cast<class_type*>(derived) == this, "'this' is not a base class for derived");
1613 
1614  buffer_operation *tmp = NULL;
1615  bool try_forwarding = false;
1616  while (op_list) {
1617  tmp = op_list;
1618  op_list = op_list->next;
1619  switch (tmp->type) {
1620  case reg_succ: internal_reg_succ(tmp); try_forwarding = true; break;
1621  case rem_succ: internal_rem_succ(tmp); break;
1622  case req_item: internal_pop(tmp); break;
1623  case res_item: internal_reserve(tmp); break;
1624  case rel_res: internal_release(tmp); try_forwarding = true; break;
1625  case con_res: internal_consume(tmp); try_forwarding = true; break;
1626  case put_item: try_forwarding = internal_push(tmp); break;
1627  case try_fwd_task: internal_forward_task(tmp); break;
1628 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
1629  // edge recording
1630  case add_blt_succ: internal_add_built_succ(tmp); break;
1631  case del_blt_succ: internal_del_built_succ(tmp); break;
1632  case add_blt_pred: internal_add_built_pred(tmp); break;
1633  case del_blt_pred: internal_del_built_pred(tmp); break;
1634  case blt_succ_cnt: internal_succ_cnt(tmp); break;
1635  case blt_pred_cnt: internal_pred_cnt(tmp); break;
1636  case blt_succ_cpy: internal_copy_succs(tmp); break;
1637  case blt_pred_cpy: internal_copy_preds(tmp); break;
1638 #endif
1639  }
1640  }
1641 
1642  derived->order();
1643 
1644  if (try_forwarding && !forwarder_busy) {
1645  if(internal::is_graph_active(this->my_graph)) {
1646  forwarder_busy = true;
1647  task *new_task = new(task::allocate_additional_child_of(*(this->my_graph.root_task()))) internal::
1648  forward_task_bypass
1649  < buffer_node<input_type, A> >(*this);
1650  // tmp should point to the last item handled by the aggregator. This is the operation
1651  // the handling thread enqueued. So modifying that record will be okay.
1652  // workaround for icc bug
1653  tbb::task *z = tmp->ltask;
1654  graph &g = this->my_graph;
1655  tmp->ltask = combine_tasks(g, z, new_task); // in case the op generated a task
1656  }
1657  }
1658  } // handle_operations
virtual void internal_release(buffer_operation *op)
Definition: flow_graph.h:1830
virtual void internal_reg_succ(buffer_operation *op)
Register successor.
Definition: flow_graph.h:1691
virtual void internal_rem_succ(buffer_operation *op)
Remove successor.
Definition: flow_graph.h:1697
virtual void internal_reserve(buffer_operation *op)
Definition: flow_graph.h:1816
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
virtual void internal_forward_task(buffer_operation *op)
Tries to forward valid items to successors.
Definition: flow_graph.h:1772
Base class for user-defined tasks.
Definition: task.h:589
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
tbb::task * root_task()
Returns the root task of the graph.
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
Definition: flow_graph.h:171
virtual bool internal_push(buffer_operation *op)
Definition: flow_graph.h:1801
virtual void internal_consume(buffer_operation *op)
Definition: flow_graph.h:1825
virtual void internal_pop(buffer_operation *op)
Definition: flow_graph.h:1807

◆ internal_consume()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual void tbb::flow::interface10::buffer_node< T, A >::internal_consume ( buffer_operation op)
inlineprotectedvirtual

◆ internal_forward_task()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual void tbb::flow::interface10::buffer_node< T, A >::internal_forward_task ( buffer_operation op)
inlineprotectedvirtual

Tries to forward valid items to successors.

Reimplemented in tbb::flow::interface10::priority_queue_node< T, Compare, A >, and tbb::flow::interface10::queue_node< T, A >.

Definition at line 1772 of file flow_graph.h.

1772  {
1773  internal_forward_task_impl(op, this);
1774  }
void internal_forward_task_impl(buffer_operation *op, derived_type *derived)
Definition: flow_graph.h:1777

◆ internal_forward_task_impl()

template<typename T, typename A = cache_aligned_allocator<T>>
template<typename derived_type >
void tbb::flow::interface10::buffer_node< T, A >::internal_forward_task_impl ( buffer_operation op,
derived_type *  derived 
)
inlineprotected

Definition at line 1777 of file flow_graph.h.

1777  {
1778  __TBB_ASSERT(static_cast<class_type*>(derived) == this, "'this' is not a base class for derived");
1779 
1780  if (this->my_reserved || !derived->is_item_valid()) {
1782  this->forwarder_busy = false;
1783  return;
1784  }
1785  // Try forwarding, giving each successor a chance
1786  task * last_task = NULL;
1787  size_type counter = my_successors.size();
1788  for (; counter > 0 && derived->is_item_valid(); --counter)
1789  derived->try_put_and_add_task(last_task);
1790 
1791  op->ltask = last_task; // return task
1792  if (last_task && !counter) {
1794  }
1795  else {
1797  forwarder_busy = false;
1798  }
1799  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:713
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
internal::round_robin_cache< T, null_rw_mutex > my_successors
Definition: flow_graph.h:1554

◆ internal_pop()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual void tbb::flow::interface10::buffer_node< T, A >::internal_pop ( buffer_operation op)
inlineprotectedvirtual

Reimplemented in tbb::flow::interface10::priority_queue_node< T, Compare, A >, and tbb::flow::interface10::queue_node< T, A >.

Definition at line 1807 of file flow_graph.h.

1807  {
1808  if(this->pop_back(*(op->elem))) {
1810  }
1811  else {
1813  }
1814  }
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:713

◆ internal_push()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual bool tbb::flow::interface10::buffer_node< T, A >::internal_push ( buffer_operation op)
inlineprotectedvirtual

Reimplemented in tbb::flow::interface10::priority_queue_node< T, Compare, A >, and tbb::flow::interface10::sequencer_node< T, A >.

Definition at line 1801 of file flow_graph.h.

1801  {
1802  this->push_back(*(op->elem));
1804  return true;
1805  }
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:713

◆ internal_reg_succ()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual void tbb::flow::interface10::buffer_node< T, A >::internal_reg_succ ( buffer_operation op)
inlineprotectedvirtual

Register successor.

Definition at line 1691 of file flow_graph.h.

1691  {
1692  my_successors.register_successor(*(op->r));
1694  }
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:713
internal::round_robin_cache< T, null_rw_mutex > my_successors
Definition: flow_graph.h:1554

◆ internal_release()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual void tbb::flow::interface10::buffer_node< T, A >::internal_release ( buffer_operation op)
inlineprotectedvirtual

Reimplemented in tbb::flow::interface10::priority_queue_node< T, Compare, A >.

Definition at line 1830 of file flow_graph.h.

1830  {
1831  this->release_front();
1833  }
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:713

References tbb::internal::__TBB_store_with_release(), and tbb::flow::interface10::internal::SUCCEEDED.

Here is the call graph for this function:

◆ internal_rem_succ()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual void tbb::flow::interface10::buffer_node< T, A >::internal_rem_succ ( buffer_operation op)
inlineprotectedvirtual

Remove successor.

Definition at line 1697 of file flow_graph.h.

1697  {
1698  my_successors.remove_successor(*(op->r));
1700  }
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:713
internal::round_robin_cache< T, null_rw_mutex > my_successors
Definition: flow_graph.h:1554

◆ internal_reserve()

template<typename T, typename A = cache_aligned_allocator<T>>
virtual void tbb::flow::interface10::buffer_node< T, A >::internal_reserve ( buffer_operation op)
inlineprotectedvirtual

Reimplemented in tbb::flow::interface10::priority_queue_node< T, Compare, A >, and tbb::flow::interface10::queue_node< T, A >.

Definition at line 1816 of file flow_graph.h.

1816  {
1817  if(this->reserve_front(*(op->elem))) {
1819  }
1820  else {
1822  }
1823  }
void __TBB_store_with_release(volatile T &location, V value)
Definition: tbb_machine.h:713

◆ is_item_valid()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::buffer_node< T, A >::is_item_valid ( )
inlineprivate

Definition at line 1756 of file flow_graph.h.

1756  {
1757  return this->my_item_valid(this->my_tail - 1);
1758  }

◆ order()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::buffer_node< T, A >::order ( )
inlineprivate

Definition at line 1754 of file flow_graph.h.

1754 {}

◆ register_successor()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::buffer_node< T, A >::register_successor ( successor_type r)
inlinevirtual

Adds a new successor.

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

Implements tbb::flow::interface10::internal::untyped_sender.

Definition at line 1867 of file flow_graph.h.

1867  {
1868  buffer_operation op_data(reg_succ);
1869  op_data.r = &r;
1870  my_aggregator.execute(&op_data);
1871  (void)enqueue_forwarding_task(op_data);
1872  return true;
1873  }
bool enqueue_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:1664
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604

◆ remove_successor()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::buffer_node< T, A >::remove_successor ( successor_type r)
inlinevirtual

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.

Implements tbb::flow::interface10::internal::untyped_sender.

Definition at line 1929 of file flow_graph.h.

1929  {
1930  r.remove_predecessor(*this);
1931  buffer_operation op_data(rem_succ);
1932  op_data.r = &r;
1933  my_aggregator.execute(&op_data);
1934  // even though this operation does not cause a forward, if we are the handler, and
1935  // a forward is scheduled, we may be the first to reach this point after the aggregator,
1936  // and so should check for the task.
1937  (void)enqueue_forwarding_task(op_data);
1938  return true;
1939  }
bool enqueue_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:1664
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604

◆ reset_node()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::buffer_node< T, A >::reset_node ( reset_flags  f)
inlineprotectedvirtual

Implements tbb::flow::interface10::graph_node.

Reimplemented in tbb::flow::interface10::priority_queue_node< T, Compare, A >, and tbb::flow::interface10::queue_node< T, A >.

Definition at line 2021 of file flow_graph.h.

2021  {
2023  // TODO: just clear structures
2024  if (f&rf_clear_edges) {
2025  my_successors.clear();
2026 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
2027  my_built_predecessors.clear();
2028 #endif
2029  }
2030  forwarder_busy = false;
2031  }
internal::round_robin_cache< T, null_rw_mutex > my_successors
Definition: flow_graph.h:1554

References internal::successor_cache< T, M >::my_successors, tbb::flow::interface10::internal::reservable_item_buffer< T, A >::reset(), and tbb::flow::interface10::rf_clear_edges.

Here is the call graph for this function:

◆ reset_receiver()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::buffer_node< T, A >::reset_receiver ( reset_flags  f)
inlineprotectedvirtual

put receiver back in initial state

Implements tbb::flow::interface10::internal::untyped_receiver.

Definition at line 2010 of file flow_graph.h.

2010 { }

◆ try_consume()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::buffer_node< T, A >::try_consume ( )
inlinevirtual

Consumes a reserved item.

true = item is removed from sender and reservation removed

Reimplemented from tbb::flow::interface10::internal::untyped_sender.

Definition at line 1974 of file flow_graph.h.

1974  {
1975  buffer_operation op_data(con_res);
1976  my_aggregator.execute(&op_data);
1977  (void)enqueue_forwarding_task(op_data);
1978  return true;
1979  }
bool enqueue_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:1664
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604

References void.

◆ try_get()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::buffer_node< T, A >::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::interface10::sender< T >.

Definition at line 1944 of file flow_graph.h.

1944  {
1945  buffer_operation op_data(req_item);
1946  op_data.elem = &v;
1947  my_aggregator.execute(&op_data);
1948  (void)enqueue_forwarding_task(op_data);
1949  return (op_data.status==internal::SUCCEEDED);
1950  }
bool enqueue_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:1664
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604

◆ try_put_and_add_task()

template<typename T, typename A = cache_aligned_allocator<T>>
void tbb::flow::interface10::buffer_node< T, A >::try_put_and_add_task ( task *&  last_task)
inlineprivate

Definition at line 1760 of file flow_graph.h.

1760  {
1761  task *new_task = my_successors.try_put_task(this->back());
1762  if (new_task) {
1763  // workaround for icc bug
1764  graph& g = this->my_graph;
1765  last_task = combine_tasks(g, last_task, new_task);
1766  this->destroy_back();
1767  }
1768  }
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
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
Definition: flow_graph.h:171
internal::round_robin_cache< T, null_rw_mutex > my_successors
Definition: flow_graph.h:1554

◆ try_put_task()

template<typename T, typename A = cache_aligned_allocator<T>>
task* tbb::flow::interface10::buffer_node< T, A >::try_put_task ( const T &  t)
inlineprotectedvirtual

receive an item, return a task *if possible

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

Definition at line 1987 of file flow_graph.h.

1987  {
1988  buffer_operation op_data(t, put_item);
1989  my_aggregator.execute(&op_data);
1990  task *ft = grab_forwarding_task(op_data);
1991  // sequencer_nodes can return failure (if an item has been previously inserted)
1992  // We have to spawn the returned task if our own operation fails.
1993 
1994  if(ft && op_data.status ==internal::FAILED) {
1995  // we haven't succeeded queueing the item, but for some reason the
1996  // call returned a task (if another request resulted in a successful
1997  // forward this could happen.) Queue the task and reset the pointer.
1999  }
2000  else if(!ft && op_data.status ==internal::SUCCEEDED) {
2001  ft = SUCCESSFULLY_ENQUEUED;
2002  }
2003  return ft;
2004  }
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604
void spawn_in_graph_arena(graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
static tbb::task *const SUCCESSFULLY_ENQUEUED
graph & graph_reference() __TBB_override
Definition: flow_graph.h:2006
task * grab_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:1660
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

◆ try_release()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::buffer_node< T, A >::try_release ( )
inlinevirtual

Release a reserved item.

true = item has been released and so remains in sender

Reimplemented from tbb::flow::interface10::internal::untyped_sender.

Definition at line 1965 of file flow_graph.h.

1965  {
1966  buffer_operation op_data(rel_res);
1967  my_aggregator.execute(&op_data);
1968  (void)enqueue_forwarding_task(op_data);
1969  return true;
1970  }
bool enqueue_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:1664
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604

◆ try_reserve()

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::buffer_node< T, A >::try_reserve ( T &  v)
inlinevirtual

Reserves an item.

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

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

Definition at line 1955 of file flow_graph.h.

1955  {
1956  buffer_operation op_data(res_item);
1957  op_data.elem = &v;
1958  my_aggregator.execute(&op_data);
1959  (void)enqueue_forwarding_task(op_data);
1960  return (op_data.status==internal::SUCCEEDED);
1961  }
bool enqueue_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:1664
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:1604

References tbb::flow::interface10::internal::SUCCEEDED, and void.

Friends And Related Function Documentation

◆ internal::aggregating_functor< class_type, buffer_operation >

template<typename T, typename A = cache_aligned_allocator<T>>
friend class internal::aggregating_functor< class_type, buffer_operation >
friend

Definition at line 1603 of file flow_graph.h.

◆ internal::broadcast_cache

template<typename T, typename A = cache_aligned_allocator<T>>
template<typename X , typename Y >
friend class internal::broadcast_cache
friend

Definition at line 1984 of file flow_graph.h.

◆ internal::forward_task_bypass< buffer_node< T, A > >

template<typename T, typename A = cache_aligned_allocator<T>>
friend class internal::forward_task_bypass< buffer_node< T, A > >
friend

Definition at line 1560 of file flow_graph.h.

◆ internal::round_robin_cache

template<typename T, typename A = cache_aligned_allocator<T>>
template<typename X , typename Y >
friend class internal::round_robin_cache
friend

Definition at line 1985 of file flow_graph.h.

◆ run_and_put_task

template<typename T, typename A = cache_aligned_allocator<T>>
template<typename R , typename B >
friend class run_and_put_task
friend

Definition at line 1983 of file flow_graph.h.

Member Data Documentation

◆ forwarder_busy

template<typename T, typename A = cache_aligned_allocator<T>>
bool tbb::flow::interface10::buffer_node< T, A >::forwarder_busy
protected

Definition at line 1601 of file flow_graph.h.

◆ my_aggregator

template<typename T, typename A = cache_aligned_allocator<T>>
internal::aggregator< handler_type, buffer_operation> tbb::flow::interface10::buffer_node< T, A >::my_aggregator
protected

Definition at line 1604 of file flow_graph.h.

◆ my_successors

template<typename T, typename A = cache_aligned_allocator<T>>
internal::round_robin_cache< T, null_rw_mutex > tbb::flow::interface10::buffer_node< T, A >::my_successors
protected

Definition at line 1554 of file flow_graph.h.


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.