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

Forwards messages only if the threshold has not been reached. More...

#include <flow_graph.h>

Inheritance diagram for tbb::flow::interface11::limiter_node< T, DecrementType >:
Collaboration diagram for tbb::flow::interface11::limiter_node< T, DecrementType >:

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

 limiter_node (graph &g, __TBB_DEPRECATED_LIMITER_ARG2(size_t threshold, int num_decrement_predecessors=0))
 Constructor. More...
 
 limiter_node (const limiter_node &src)
 Copy constructor. More...
 
bool register_successor (successor_type &r) __TBB_override
 Replace the current successor with this new successor. More...
 
bool remove_successor (successor_type &r) __TBB_override
 Removes a successor from this node. More...
 
bool register_predecessor (predecessor_type &src) __TBB_override
 Adds src to the list of cached predecessors. More...
 
bool remove_predecessor (predecessor_type &src) __TBB_override
 Removes src from the list of cached predecessors. More...
 
- Public Member Functions inherited from tbb::flow::interface11::graph_node
 graph_node (graph &g)
 
virtual ~graph_node ()
 
- 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...
 
- Public Member Functions inherited from tbb::flow::interface11::sender< T >
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 try_release ()
 Releases the reserved item. More...
 
virtual bool try_consume ()
 Consumes the reserved item. More...
 

Public Attributes

internal::decrementer< limiter_node< T, DecrementType >, DecrementType > decrement
 The internal receiver< DecrementType > that decrements the count. More...
 
- 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
 

Protected Member Functions

tasktry_put_task (const T &t) __TBB_override
 Puts an item to this receiver. 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 tbb::flow::interface11::receiver< T >
virtual tasktry_put_task_wrapper (const void *p, bool is_async) __TBB_override
 
- Protected Member Functions inherited from tbb::flow::interface11::internal::untyped_receiver
template<typename X >
tasktry_put_task (const X &t)
 
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...
 

Private Member Functions

bool check_conditions ()
 
taskforward_task ()
 
void forward ()
 
taskdecrement_counter (long long delta)
 
void initialize ()
 

Private Attributes

size_t my_threshold
 
size_t my_count
 
size_t my_tries
 
internal::reservable_predecessor_cache< T, spin_mutexmy_predecessors
 
spin_mutex my_mutex
 
internal::broadcast_cache< T > my_successors
 

Friends

class internal::forward_task_bypass< limiter_node< T, DecrementType > >
 
class internal::decrementer< limiter_node< T, DecrementType >, DecrementType >
 
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

- Protected Attributes inherited from tbb::flow::interface11::graph_node
graphmy_graph
 
graph_nodenext
 
graph_nodeprev
 

Detailed Description

template<typename T, typename DecrementType = continue_msg>
class tbb::flow::interface11::limiter_node< T, DecrementType >

Forwards messages only if the threshold has not been reached.

This node forwards items until its threshold is reached. It contains no buffering. If the downstream node rejects, the message is dropped.

Definition at line 113 of file flow_graph.h.

Member Typedef Documentation

◆ input_type

template<typename T , typename DecrementType = continue_msg>
typedef T tbb::flow::interface11::limiter_node< T, DecrementType >::input_type

Definition at line 2600 of file flow_graph.h.

◆ output_type

template<typename T , typename DecrementType = continue_msg>
typedef T tbb::flow::interface11::limiter_node< T, DecrementType >::output_type

Definition at line 2601 of file flow_graph.h.

◆ predecessor_type

template<typename T , typename DecrementType = continue_msg>
typedef receiver<input_type>::predecessor_type tbb::flow::interface11::limiter_node< T, DecrementType >::predecessor_type

Definition at line 2602 of file flow_graph.h.

◆ successor_type

template<typename T , typename DecrementType = continue_msg>
typedef sender<output_type>::successor_type tbb::flow::interface11::limiter_node< T, DecrementType >::successor_type

Definition at line 2603 of file flow_graph.h.

Constructor & Destructor Documentation

◆ limiter_node() [1/2]

template<typename T , typename DecrementType = continue_msg>
tbb::flow::interface11::limiter_node< T, DecrementType >::limiter_node ( graph g,
__TBB_DEPRECATED_LIMITER_ARG2(size_t threshold, int num_decrement_predecessors=0)   
)
inline

Constructor.

Definition at line 2723 of file flow_graph.h.

2725  : graph_node(g), my_threshold(threshold), my_count(0),
2727  my_tries(0), decrement(),
2728  init_decrement_predecessors(num_decrement_predecessors),
2729  decrement(num_decrement_predecessors)) {
2730  initialize();
2731  }
#define __TBB_DEPRECATED_LIMITER_ARG4(arg1, arg2, arg3, arg4)
internal::decrementer< limiter_node< T, DecrementType >, DecrementType > decrement
The internal receiver< DecrementType > that decrements the count.
Definition: flow_graph.h:2714

◆ limiter_node() [2/2]

template<typename T , typename DecrementType = continue_msg>
tbb::flow::interface11::limiter_node< T, DecrementType >::limiter_node ( const limiter_node< T, DecrementType > &  src)
inline

Copy constructor.

Definition at line 2742 of file flow_graph.h.

References __TBB_override, and tbb::internal::fgt_node_desc().

2742  :
2743  graph_node(src.my_graph), receiver<T>(), sender<T>(),
2744  my_threshold(src.my_threshold), my_count(0),
2746  my_tries(0), decrement(),
2747  init_decrement_predecessors(src.init_decrement_predecessors),
2748  decrement(src.init_decrement_predecessors)) {
2749  initialize();
2750  }
#define __TBB_DEPRECATED_LIMITER_ARG4(arg1, arg2, arg3, arg4)
internal::decrementer< limiter_node< T, DecrementType >, DecrementType > decrement
The internal receiver< DecrementType > that decrements the count.
Definition: flow_graph.h:2714
Here is the call graph for this function:

Member Function Documentation

◆ check_conditions()

template<typename T , typename DecrementType = continue_msg>
bool tbb::flow::interface11::limiter_node< T, DecrementType >::check_conditions ( )
inlineprivate

Definition at line 2626 of file flow_graph.h.

References tbb::flow::interface11::internal::node_cache< untyped_sender, M >::empty(), and tbb::flow::interface11::internal::successor_cache< T, M >::empty().

2626  { // always called under lock
2627  return ( my_count + my_tries < my_threshold && !my_predecessors.empty() && !my_successors.empty() );
2628  }
internal::broadcast_cache< T > my_successors
Definition: flow_graph.h:2618
internal::reservable_predecessor_cache< T, spin_mutex > my_predecessors
Definition: flow_graph.h:2616
Here is the call graph for this function:

◆ decrement_counter()

template<typename T , typename DecrementType = continue_msg>
task* tbb::flow::interface11::limiter_node< T, DecrementType >::decrement_counter ( long long  delta)
inlineprivate

Definition at line 2689 of file flow_graph.h.

References lock.

2689  {
2690  {
2692  if( delta > 0 && size_t(delta) > my_count )
2693  my_count = 0;
2694  else if( delta < 0 && size_t(delta) > my_threshold - my_count )
2696  else
2697  my_count -= size_t(delta); // absolute value of delta is sufficiently small
2698  }
2699  return forward_task();
2700  }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock
friend class scoped_lock
Definition: spin_mutex.h:179

◆ forward()

template<typename T , typename DecrementType = continue_msg>
void tbb::flow::interface11::limiter_node< T, DecrementType >::forward ( )
inlineprivate

Definition at line 2684 of file flow_graph.h.

References __TBB_ASSERT.

2684  {
2685  __TBB_ASSERT(false, "Should never be called");
2686  return;
2687  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

◆ forward_task()

template<typename T , typename DecrementType = continue_msg>
task* tbb::flow::interface11::limiter_node< T, DecrementType >::forward_task ( )
inlineprivate

Definition at line 2631 of file flow_graph.h.

References __TBB_ASSERT, tbb::flow::interface11::internal::function_output< Output >::graph_reference(), tbb::flow::interface11::internal::is_graph_active(), lock, tbb::flow::interface11::internal::spawn_in_graph_arena(), tbb::flow::interface11::internal::reservable_predecessor_cache< T, M >::try_consume(), tbb::flow::interface11::internal::broadcast_cache< T, M >::try_put_task(), tbb::flow::interface11::internal::reservable_predecessor_cache< T, M >::try_release(), and tbb::flow::interface11::internal::reservable_predecessor_cache< T, M >::try_reserve().

2631  {
2632  input_type v;
2633  task *rval = NULL;
2634  bool reserved = false;
2635  {
2637  if ( check_conditions() )
2638  ++my_tries;
2639  else
2640  return NULL;
2641  }
2642 
2643  //SUCCESS
2644  // if we can reserve and can put, we consume the reservation
2645  // we increment the count and decrement the tries
2646  if ( (my_predecessors.try_reserve(v)) == true ){
2647  reserved=true;
2648  if ( (rval = my_successors.try_put_task(v)) != NULL ){
2649  {
2651  ++my_count;
2652  --my_tries;
2653  my_predecessors.try_consume();
2654  if ( check_conditions() ) {
2655  if ( internal::is_graph_active(this->my_graph) ) {
2656  task *rtask = new ( task::allocate_additional_child_of( *(this->my_graph.root_task()) ) )
2657  internal::forward_task_bypass< limiter_node<T, DecrementType> >( *this );
2659  }
2660  }
2661  }
2662  return rval;
2663  }
2664  }
2665  //FAILURE
2666  //if we can't reserve, we decrement the tries
2667  //if we can reserve but can't put, we decrement the tries and release the reservation
2668  {
2670  --my_tries;
2671  if (reserved) my_predecessors.try_release();
2672  if ( check_conditions() ) {
2673  if ( internal::is_graph_active(this->my_graph) ) {
2674  task *rtask = new ( task::allocate_additional_child_of( *(this->my_graph.root_task()) ) )
2675  internal::forward_task_bypass< limiter_node<T, DecrementType> >( *this );
2676  __TBB_ASSERT(!rval, "Have two tasks to handle");
2677  return rtask;
2678  }
2679  }
2680  return rval;
2681  }
2682  }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock
A task that calls a node&#39;s forward_task function.
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
bool is_graph_active(tbb::flow::interface10::graph &g)
internal::broadcast_cache< T > my_successors
Definition: flow_graph.h:2618
friend class scoped_lock
Definition: spin_mutex.h:179
graph & graph_reference() const __TBB_override
Definition: flow_graph.h:2873
tbb::task * root_task()
Returns the root task of the graph.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
void spawn_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
internal::reservable_predecessor_cache< T, spin_mutex > my_predecessors
Definition: flow_graph.h:2616
Here is the call graph for this function:

◆ graph_reference()

template<typename T , typename DecrementType = continue_msg>
graph& tbb::flow::interface11::limiter_node< T, DecrementType >::graph_reference ( ) const
inlineprotectedvirtual

◆ initialize()

template<typename T , typename DecrementType = continue_msg>
void tbb::flow::interface11::limiter_node< T, DecrementType >::initialize ( )
inlineprivate

Definition at line 2702 of file flow_graph.h.

References CODEPTR, tbb::internal::fgt_node(), tbb::flow::interface11::internal::predecessor_cache< T, M >::set_owner(), and tbb::flow::interface11::internal::successor_cache< T, M >::set_owner().

2702  {
2703  my_predecessors.set_owner(this);
2704  my_successors.set_owner(this);
2705  decrement.set_owner(this);
2707  CODEPTR(), tbb::internal::FLOW_LIMITER_NODE, &this->my_graph,
2708  static_cast<receiver<input_type> *>(this), static_cast<receiver<DecrementType> *>(&decrement),
2709  static_cast<sender<output_type> *>(this)
2710  );
2711  }
static void fgt_node(void *, string_index, void *, void *)
internal::broadcast_cache< T > my_successors
Definition: flow_graph.h:2618
internal::decrementer< limiter_node< T, DecrementType >, DecrementType > decrement
The internal receiver< DecrementType > that decrements the count.
Definition: flow_graph.h:2714
#define CODEPTR()
internal::reservable_predecessor_cache< T, spin_mutex > my_predecessors
Definition: flow_graph.h:2616
Here is the call graph for this function:

◆ register_predecessor()

template<typename T , typename DecrementType = continue_msg>
bool tbb::flow::interface11::limiter_node< T, DecrementType >::register_predecessor ( predecessor_type src)
inlinevirtual

Adds src to the list of cached predecessors.

Reimplemented from tbb::flow::interface11::internal::untyped_receiver.

Definition at line 2823 of file flow_graph.h.

References tbb::flow::interface11::internal::node_cache< untyped_sender, M >::add(), tbb::flow::interface11::internal::successor_cache< T, M >::empty(), tbb::flow::interface11::internal::function_output< Output >::graph_reference(), tbb::flow::interface11::internal::is_graph_active(), lock, and tbb::flow::interface11::internal::spawn_in_graph_arena().

2823  {
2825  my_predecessors.add( src );
2827  task* task = new ( task::allocate_additional_child_of( *(this->my_graph.root_task()) ) )
2828  internal::forward_task_bypass < limiter_node<T, DecrementType> >( *this );
2830  }
2831  return true;
2832  }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock
A task that calls a node&#39;s forward_task function.
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
bool is_graph_active(tbb::flow::interface10::graph &g)
internal::broadcast_cache< T > my_successors
Definition: flow_graph.h:2618
friend class scoped_lock
Definition: spin_mutex.h:179
graph & graph_reference() const __TBB_override
Definition: flow_graph.h:2873
tbb::task * root_task()
Returns the root task of the graph.
void spawn_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
internal::reservable_predecessor_cache< T, spin_mutex > my_predecessors
Definition: flow_graph.h:2616
Here is the call graph for this function:

◆ register_successor()

template<typename T , typename DecrementType = continue_msg>
bool tbb::flow::interface11::limiter_node< T, DecrementType >::register_successor ( successor_type r)
inlinevirtual

Replace the current successor with this new successor.

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

Definition at line 2759 of file flow_graph.h.

References tbb::flow::interface11::internal::node_cache< untyped_sender, M >::empty(), tbb::flow::interface11::internal::successor_cache< T, M >::empty(), tbb::flow::interface11::internal::function_output< Output >::graph_reference(), tbb::flow::interface11::internal::is_graph_active(), lock, tbb::flow::interface11::internal::successor_cache< T, M >::register_successor(), and tbb::flow::interface11::internal::spawn_in_graph_arena().

2759  {
2761  bool was_empty = my_successors.empty();
2763  //spawn a forward task if this is the only successor
2764  if ( was_empty && !my_predecessors.empty() && my_count + my_tries < my_threshold ) {
2765  if ( internal::is_graph_active(this->my_graph) ) {
2766  task* task = new ( task::allocate_additional_child_of( *(this->my_graph.root_task()) ) )
2767  internal::forward_task_bypass < limiter_node<T, DecrementType> >( *this );
2769  }
2770  }
2771  return true;
2772  }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock
A task that calls a node&#39;s forward_task function.
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
bool is_graph_active(tbb::flow::interface10::graph &g)
internal::broadcast_cache< T > my_successors
Definition: flow_graph.h:2618
friend class scoped_lock
Definition: spin_mutex.h:179
graph & graph_reference() const __TBB_override
Definition: flow_graph.h:2873
tbb::task * root_task()
Returns the root task of the graph.
void spawn_in_graph_arena(tbb::flow::interface10::graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
internal::reservable_predecessor_cache< T, spin_mutex > my_predecessors
Definition: flow_graph.h:2616
Here is the call graph for this function:

◆ remove_predecessor()

template<typename T , typename DecrementType = continue_msg>
bool tbb::flow::interface11::limiter_node< T, DecrementType >::remove_predecessor ( predecessor_type src)
inlinevirtual

Removes src from the list of cached predecessors.

Reimplemented from tbb::flow::interface11::internal::untyped_receiver.

Definition at line 2835 of file flow_graph.h.

References tbb::flow::interface11::internal::node_cache< untyped_sender, M >::remove().

2835  {
2836  my_predecessors.remove( src );
2837  return true;
2838  }
internal::reservable_predecessor_cache< T, spin_mutex > my_predecessors
Definition: flow_graph.h:2616
Here is the call graph for this function:

◆ remove_successor()

template<typename T , typename DecrementType = continue_msg>
bool tbb::flow::interface11::limiter_node< T, DecrementType >::remove_successor ( successor_type r)
inlinevirtual

Removes a successor from this node.

r.remove_predecessor(*this) is also called.

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

Definition at line 2776 of file flow_graph.h.

References __TBB_override, and tbb::flow::interface11::internal::successor_cache< T, M >::remove_successor().

2776  {
2777  r.remove_predecessor(*this);
2779  return true;
2780  }
internal::broadcast_cache< T > my_successors
Definition: flow_graph.h:2618
Here is the call graph for this function:

◆ reset_node()

template<typename T , typename DecrementType = continue_msg>
void tbb::flow::interface11::limiter_node< T, DecrementType >::reset_node ( reset_flags  f)
inlineprotectedvirtual

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

Definition at line 2879 of file flow_graph.h.

References tbb::flow::interface11::internal::reservable_predecessor_cache< T, M >::clear(), tbb::flow::interface11::internal::successor_cache< T, M >::clear(), tbb::flow::interface11::internal::input_port(), and tbb::flow::interface11::internal::reservable_predecessor_cache< T, M >::reset().

2879  {
2880  my_count = 0;
2881  if(f & rf_clear_edges) {
2882  my_predecessors.clear();
2883  my_successors.clear();
2884  }
2885  else
2886  {
2887  my_predecessors.reset( );
2888  }
2889  decrement.reset_receiver(f);
2890  }
internal::broadcast_cache< T > my_successors
Definition: flow_graph.h:2618
internal::decrementer< limiter_node< T, DecrementType >, DecrementType > decrement
The internal receiver< DecrementType > that decrements the count.
Definition: flow_graph.h:2714
internal::reservable_predecessor_cache< T, spin_mutex > my_predecessors
Definition: flow_graph.h:2616
Here is the call graph for this function:

◆ reset_receiver()

template<typename T , typename DecrementType = continue_msg>
void tbb::flow::interface11::limiter_node< T, DecrementType >::reset_receiver ( reset_flags  f)
inlineprotectedvirtual

put receiver back in initial state

Implements tbb::flow::interface11::internal::untyped_receiver.

Definition at line 2875 of file flow_graph.h.

References __TBB_ASSERT.

2875  {
2876  __TBB_ASSERT(false,NULL); // should never be called
2877  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

◆ try_put_task()

template<typename T , typename DecrementType = continue_msg>
task* tbb::flow::interface11::limiter_node< T, DecrementType >::try_put_task ( const T &  t)
inlineprotectedvirtual

Puts an item to this receiver.

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

Definition at line 2846 of file flow_graph.h.

References tbb::flow::interface11::internal::is_graph_active(), lock, and tbb::flow::interface11::internal::broadcast_cache< T, M >::try_put_task().

2846  {
2847  {
2849  if ( my_count + my_tries >= my_threshold )
2850  return NULL;
2851  else
2852  ++my_tries;
2853  }
2854 
2855  task * rtask = my_successors.try_put_task(t);
2856 
2857  if ( !rtask ) { // try_put_task failed.
2859  --my_tries;
2861  rtask = new ( task::allocate_additional_child_of( *(this->my_graph.root_task()) ) )
2862  internal::forward_task_bypass< limiter_node<T, DecrementType> >( *this );
2863  }
2864  }
2865  else {
2867  ++my_count;
2868  --my_tries;
2869  }
2870  return rtask;
2871  }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock
A task that calls a node&#39;s forward_task function.
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
bool is_graph_active(tbb::flow::interface10::graph &g)
internal::broadcast_cache< T > my_successors
Definition: flow_graph.h:2618
friend class scoped_lock
Definition: spin_mutex.h:179
tbb::task * root_task()
Returns the root task of the graph.
Here is the call graph for this function:

Friends And Related Function Documentation

◆ internal::broadcast_cache

template<typename T , typename DecrementType = continue_msg>
template<typename X , typename Y >
friend class internal::broadcast_cache
friend

Definition at line 2843 of file flow_graph.h.

◆ internal::decrementer< limiter_node< T, DecrementType >, DecrementType >

template<typename T , typename DecrementType = continue_msg>
friend class internal::decrementer< limiter_node< T, DecrementType >, DecrementType >
friend

Definition at line 2624 of file flow_graph.h.

◆ internal::forward_task_bypass< limiter_node< T, DecrementType > >

template<typename T , typename DecrementType = continue_msg>
friend class internal::forward_task_bypass< limiter_node< T, DecrementType > >
friend

Definition at line 2621 of file flow_graph.h.

◆ internal::round_robin_cache

template<typename T , typename DecrementType = continue_msg>
template<typename X , typename Y >
friend class internal::round_robin_cache
friend

Definition at line 2844 of file flow_graph.h.

◆ run_and_put_task

template<typename T , typename DecrementType = continue_msg>
template<typename R , typename B >
friend class run_and_put_task
friend

Definition at line 2842 of file flow_graph.h.

Member Data Documentation

◆ decrement

template<typename T , typename DecrementType = continue_msg>
internal::decrementer< limiter_node<T, DecrementType>, DecrementType > tbb::flow::interface11::limiter_node< T, DecrementType >::decrement

The internal receiver< DecrementType > that decrements the count.

Definition at line 2714 of file flow_graph.h.

◆ my_count

template<typename T , typename DecrementType = continue_msg>
size_t tbb::flow::interface11::limiter_node< T, DecrementType >::my_count
private

Definition at line 2614 of file flow_graph.h.

◆ my_mutex

template<typename T , typename DecrementType = continue_msg>
spin_mutex tbb::flow::interface11::limiter_node< T, DecrementType >::my_mutex
private

◆ my_predecessors

template<typename T , typename DecrementType = continue_msg>
internal::reservable_predecessor_cache< T, spin_mutex > tbb::flow::interface11::limiter_node< T, DecrementType >::my_predecessors
private

Definition at line 2616 of file flow_graph.h.

◆ my_successors

template<typename T , typename DecrementType = continue_msg>
internal::broadcast_cache< T > tbb::flow::interface11::limiter_node< T, DecrementType >::my_successors
private

Definition at line 2618 of file flow_graph.h.

◆ my_threshold

template<typename T , typename DecrementType = continue_msg>
size_t tbb::flow::interface11::limiter_node< T, DecrementType >::my_threshold
private

Definition at line 2613 of file flow_graph.h.

◆ my_tries

template<typename T , typename DecrementType = continue_msg>
size_t tbb::flow::interface11::limiter_node< T, DecrementType >::my_tries
private

Definition at line 2615 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.