Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
internal::broadcast_cache< T, M > Class Template Reference

A cache of successors that are broadcast to. More...

#include <_flow_graph_cache_impl.h>

Inheritance diagram for internal::broadcast_cache< T, M >:
Collaboration diagram for internal::broadcast_cache< T, M >:

Public Member Functions

 broadcast_cache ()
 
tasktry_put_task (const T &t) __TBB_override
 
- Public Member Functions inherited from internal::successor_cache< T, M >
 successor_cache ()
 
void set_owner (owner_type *owner)
 
virtual ~successor_cache ()
 
void register_successor (successor_type &r)
 
void remove_successor (successor_type &r)
 
bool empty ()
 
void clear ()
 

Private Types

typedef M mutex_type
 
typedef successor_cache< T, M >::successors_type successors_type
 

Additional Inherited Members

- Protected Types inherited from internal::successor_cache< T, M >
typedef M mutex_type
 
typedef receiver< T > successor_type
 
typedef receiver< T > * pointer_type
 
typedef sender< T > owner_type
 
typedef std::list< pointer_typesuccessors_type
 
- Protected Attributes inherited from internal::successor_cache< T, M >
mutex_type my_mutex
 
successors_type my_successors
 
owner_typemy_owner
 

Detailed Description

template<typename T, typename M = spin_rw_mutex>
class internal::broadcast_cache< T, M >

A cache of successors that are broadcast to.

Definition at line 469 of file _flow_graph_cache_impl.h.

Member Typedef Documentation

◆ mutex_type

template<typename T, typename M = spin_rw_mutex>
typedef M internal::broadcast_cache< T, M >::mutex_type
private

Definition at line 470 of file _flow_graph_cache_impl.h.

◆ successors_type

template<typename T, typename M = spin_rw_mutex>
typedef successor_cache<T,M>::successors_type internal::broadcast_cache< T, M >::successors_type
private

Definition at line 471 of file _flow_graph_cache_impl.h.

Constructor & Destructor Documentation

◆ broadcast_cache()

template<typename T, typename M = spin_rw_mutex>
internal::broadcast_cache< T, M >::broadcast_cache ( )
inline

Definition at line 475 of file _flow_graph_cache_impl.h.

475 {}

Member Function Documentation

◆ try_put_task()

template<typename T, typename M = spin_rw_mutex>
task* internal::broadcast_cache< T, M >::try_put_task ( const T &  t)
inlinevirtual

Implements internal::successor_cache< T, M >.

Definition at line 482 of file _flow_graph_cache_impl.h.

482  {
483 #endif // __TBB_PREVIEW_ASYNC_MSG
484  task * last_task = NULL;
485  bool upgraded = true;
486  typename mutex_type::scoped_lock l(this->my_mutex, upgraded);
487  typename successors_type::iterator i = this->my_successors.begin();
488  while ( i != this->my_successors.end() ) {
489  task *new_task = (*i)->try_put_task(t);
490  // workaround for icc bug
491  graph& graph_ref = (*i)->graph_reference();
492  last_task = combine_tasks(graph_ref, last_task, new_task); // enqueue if necessary
493  if(new_task) {
494  ++i;
495  }
496  else { // failed
497  if ( (*i)->register_predecessor(*this->my_owner) ) {
498  if (!upgraded) {
499  l.upgrade_to_writer();
500  upgraded = true;
501  }
502  i = this->my_successors.erase(i);
503  } else {
504  ++i;
505  }
506  }
507  }
508  return last_task;
509  }
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
Definition: flow_graph.h:171
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

Referenced by internal::continue_input< Output, Policy >::apply_body_bypass(), internal::function_input< Input, Output, Policy, A >::apply_body_impl_bypass(), internal::indexer_node_base< InputTuple, OutputType, StructTypes >::handle_operations(), internal::function_output< Output >::try_put_task(), and internal::multifunction_output< Output >::try_put_task().

Here is the caller graph for this function:

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.