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 Types inherited from tbb::flow::interface11::internal::untyped_receiver
typedef untyped_sender predecessor_type
 The predecessor type for this node. More...
 
- Public Types inherited from tbb::flow::interface11::internal::untyped_sender
typedef untyped_receiver successor_type
 The successor type for this node. More...
 

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 >
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::interface11::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...
 
virtual bool try_get (T &)
 Request an item from the sender. More...
 
virtual bool try_reserve (T &)
 Reserves an item in the sender. More...
 
- Public Member Functions inherited from tbb::flow::interface11::internal::untyped_sender
virtual ~untyped_sender ()
 
virtual bool register_successor (successor_type &r)=0
 Add a new successor to this node. More...
 
virtual bool remove_successor (successor_type &r)=0
 Removes a successor from this node. More...
 
virtual bool try_release ()
 Releases the reserved item. More...
 
virtual bool try_consume ()
 Consumes the reserved item. 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
 
virtual void reset_node (reset_flags f=rf_reset_protocol)=0
 
- 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 tasktry_put_task_wrapper (const void *p, bool is_async) __TBB_override
 
virtual tasktry_put_task (const T &t)=0
 Put item to successor; return task to run the successor if possible. More...
 
- Protected Member Functions inherited from tbb::flow::interface11::internal::untyped_receiver
template<typename X >
tasktry_put_task (const X &t)
 
virtual tasktry_put_task_wrapper (const void *p, bool is_async)=0
 
virtual graphgraph_reference () const =0
 
virtual void reset_receiver (reset_flags f=rf_reset_protocol)=0
 put receiver back in initial state More...
 
virtual bool is_continue_receiver ()
 
- Protected Member Functions inherited from tbb::flow::interface11::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::interface11::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...
 
virtual bool try_get_wrapper (void *p, bool is_async)=0
 
virtual bool try_reserve_wrapper (void *p, bool is_async)=0
 

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 internal::async_helpers< T >::filtered_type filtered_type
 
- 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 internal::async_helpers< T >::filtered_type filtered_type
 
- 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 }
#define CODEPTR()
static void fgt_node(void *, string_index, void *, void *)
internal::round_robin_cache< T, null_rw_mutex > my_successors
Definition: flow_graph.h:2069
internal::aggregator< handler_type, buffer_operation > my_aggregator
Definition: flow_graph.h:2119
internal::aggregating_functor< class_type, buffer_operation > handler_type
Definition: flow_graph.h:2117
item_buffer with reservable front-end. NOTE: if reserving, do not

References CODEPTR, tbb::internal::fgt_node(), tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, tbb::flow::interface11::graph_node::my_graph, and tbb::flow::interface11::buffer_node< T, Allocator >::my_successors.

Here is the call graph for this function:

◆ 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 }

References CODEPTR, tbb::internal::fgt_node(), tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, tbb::flow::interface11::graph_node::my_graph, and tbb::flow::interface11::buffer_node< T, Allocator >::my_successors.

Here is the call graph for this function:

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

Definition at line 2178 of file flow_graph.h.

2178 {
2179 task *ft = grab_forwarding_task(op_data);
2180 if(ft) {
2182 return true;
2183 }
2184 return false;
2185 }
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
void spawn_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
graph & graph_reference() const __TBB_override
Definition: flow_graph.h:2530
task * grab_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:2174

References tbb::flow::interface11::buffer_node< T, Allocator >::grab_forwarding_task(), tbb::flow::interface11::buffer_node< T, Allocator >::graph_reference(), and tbb::flow::interface11::internal::spawn_in_graph_arena().

Referenced by tbb::flow::interface11::buffer_node< T, Allocator >::register_successor(), tbb::flow::interface11::buffer_node< T, Allocator >::remove_successor(), tbb::flow::interface11::buffer_node< T, Allocator >::try_consume(), tbb::flow::interface11::buffer_node< T, Allocator >::try_get(), tbb::flow::interface11::buffer_node< T, Allocator >::try_release(), and tbb::flow::interface11::buffer_node< T, Allocator >::try_reserve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 }
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
Definition: flow_graph.h:198
Base class for user-defined tasks.
Definition: task.h:615

References tbb::flow::interface11::combine_tasks(), tbb::flow::interface11::buffer_node< T, Allocator >::buffer_operation::ltask, tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, tbb::flow::interface11::graph_node::my_graph, tbb::interface6::internal::aggregated_operation< Derived >::status, internal::SUCCEEDED, tbb::flow::interface11::buffer_node< T, Allocator >::try_fwd_task, and internal::WAIT.

Here is the call graph for this function:

◆ 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

◆ graph_reference()

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

◆ 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 }
void handle_operations_impl(buffer_operation *op_list, derived_type *derived)
Definition: flow_graph.h:2126

References tbb::flow::interface11::buffer_node< T, Allocator >::handle_operations_impl().

Here is the call graph for this function:

◆ 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) {
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
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
bool is_graph_active(tbb::flow::interface10::graph &g)
virtual bool internal_push(buffer_operation *op)
Definition: flow_graph.h:2315
virtual void internal_rem_succ(buffer_operation *op)
Remove successor.
Definition: flow_graph.h:2211
virtual void internal_consume(buffer_operation *op)
Definition: flow_graph.h:2339
virtual void internal_pop(buffer_operation *op)
Definition: flow_graph.h:2321
virtual void internal_reserve(buffer_operation *op)
Definition: flow_graph.h:2330
buffer_node< T, Allocator > class_type
Definition: flow_graph.h:2054
virtual void internal_forward_task(buffer_operation *op)
Tries to forward valid items to successors.
Definition: flow_graph.h:2286
virtual void internal_reg_succ(buffer_operation *op)
Register successor.
Definition: flow_graph.h:2205
virtual void internal_release(buffer_operation *op)
Definition: flow_graph.h:2344
tbb::task * root_task()
Returns the root task of the graph.

References __TBB_ASSERT, tbb::flow::interface11::combine_tasks(), tbb::flow::interface11::buffer_node< T, Allocator >::con_res, tbb::flow::interface11::buffer_node< T, Allocator >::forwarder_busy, tbb::flow::interface11::buffer_node< T, Allocator >::internal_consume(), tbb::flow::interface11::buffer_node< T, Allocator >::internal_forward_task(), tbb::flow::interface11::buffer_node< T, Allocator >::internal_pop(), tbb::flow::interface11::buffer_node< T, Allocator >::internal_push(), tbb::flow::interface11::buffer_node< T, Allocator >::internal_reg_succ(), tbb::flow::interface11::buffer_node< T, Allocator >::internal_release(), tbb::flow::interface11::buffer_node< T, Allocator >::internal_rem_succ(), tbb::flow::interface11::buffer_node< T, Allocator >::internal_reserve(), tbb::flow::interface11::internal::is_graph_active(), tbb::flow::interface11::buffer_node< T, Allocator >::buffer_operation::ltask, tbb::flow::interface11::graph_node::my_graph, tbb::interface6::internal::aggregated_operation< Derived >::next, tbb::flow::interface11::buffer_node< T, Allocator >::put_item, tbb::flow::interface11::buffer_node< T, Allocator >::reg_succ, tbb::flow::interface11::buffer_node< T, Allocator >::rel_res, tbb::flow::interface11::buffer_node< T, Allocator >::rem_succ, tbb::flow::interface11::buffer_node< T, Allocator >::req_item, tbb::flow::interface11::buffer_node< T, Allocator >::res_item, tbb::flow::interface10::graph::root_task(), tbb::flow::interface11::buffer_node< T, Allocator >::try_fwd_task, and tbb::flow::interface11::buffer_node< T, Allocator >::buffer_operation::type.

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

Here is the call graph for this function:
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

◆ 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 {
2288 }
void internal_forward_task_impl(buffer_operation *op, derived_type *derived)
Definition: flow_graph.h:2291

References tbb::flow::interface11::buffer_node< T, Allocator >::internal_forward_task_impl().

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

Here is the call graph for this function:
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 }

References __TBB_ASSERT, tbb::internal::__TBB_store_with_release(), internal::FAILED, tbb::flow::interface11::buffer_node< T, Allocator >::forwarder_busy, tbb::flow::interface11::buffer_node< T, Allocator >::buffer_operation::ltask, internal::reservable_item_buffer< T, cache_aligned_allocator< T > >::my_reserved, tbb::flow::interface11::buffer_node< T, Allocator >::my_successors, tbb::interface6::internal::aggregated_operation< Derived >::status, and internal::SUCCEEDED.

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

Here is the call graph for this function:
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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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)
inlinevirtual

Adds a new successor.

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

Implements tbb::flow::interface11::internal::untyped_sender.

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 }
bool enqueue_forwarding_task(buffer_operation &op_data)
Definition: flow_graph.h:2178

References tbb::flow::interface11::buffer_node< T, Allocator >::enqueue_forwarding_task(), tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, tbb::flow::interface11::buffer_node< T, Allocator >::buffer_operation::r, tbb::flow::interface11::buffer_node< T, Allocator >::reg_succ, and void.

Here is the call graph for this function:

◆ 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)
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::interface11::internal::untyped_sender.

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 }

References tbb::flow::interface11::buffer_node< T, Allocator >::enqueue_forwarding_task(), tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, tbb::flow::interface11::buffer_node< T, Allocator >::buffer_operation::r, tbb::flow::interface11::buffer_node< T, Allocator >::rem_succ, and void.

Here is the call graph for this function:

◆ 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

◆ 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::internal::untyped_receiver.

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::internal::untyped_sender.

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 }

References tbb::flow::interface11::buffer_node< T, Allocator >::con_res, tbb::flow::interface11::buffer_node< T, Allocator >::enqueue_forwarding_task(), tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, and void.

Here is the call graph for this function:

◆ 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 }

References tbb::flow::interface11::buffer_node< T, Allocator >::buffer_operation::elem, tbb::flow::interface11::buffer_node< T, Allocator >::enqueue_forwarding_task(), tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, tbb::flow::interface11::buffer_node< T, Allocator >::req_item, tbb::interface6::internal::aggregated_operation< Derived >::status, internal::SUCCEEDED, and void.

Here is the call graph for this function:

◆ 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

◆ 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) {
2526 }
2527 return ft;
2528 }
static tbb::task *const SUCCESSFULLY_ENQUEUED

References internal::FAILED, tbb::flow::interface11::buffer_node< T, Allocator >::grab_forwarding_task(), tbb::flow::interface11::buffer_node< T, Allocator >::graph_reference(), tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, tbb::flow::interface11::buffer_node< T, Allocator >::put_item, tbb::flow::interface11::internal::spawn_in_graph_arena(), tbb::interface6::internal::aggregated_operation< Derived >::status, internal::SUCCEEDED, and tbb::flow::internal::SUCCESSFULLY_ENQUEUED.

Here is the call graph for this function:

◆ 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::internal::untyped_sender.

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 }

References tbb::flow::interface11::buffer_node< T, Allocator >::enqueue_forwarding_task(), tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, tbb::flow::interface11::buffer_node< T, Allocator >::rel_res, and void.

Here is the call graph for this function:

◆ 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 }

References tbb::flow::interface11::buffer_node< T, Allocator >::buffer_operation::elem, tbb::flow::interface11::buffer_node< T, Allocator >::enqueue_forwarding_task(), tbb::flow::interface11::buffer_node< T, Allocator >::my_aggregator, tbb::flow::interface11::buffer_node< T, Allocator >::res_item, tbb::interface6::internal::aggregated_operation< Derived >::status, internal::SUCCEEDED, and void.

Here is the call graph for this function:

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 2117 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 2069 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:

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.