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 ()
task * | try_put_task (const T &t) __TBB_override
bool | gather_successful_try_puts (const T &t, task_list &tasks)
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_type > | successors_type
Protected Attributes inherited from internal::successor_cache< T, M >
mutex_type | my_mutex
successors_type | my_successors
owner_type * | my_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 465 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 466 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 467 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 471 of file _flow_graph_cache_impl.h.

{}

## Member Function Documentation

## gather_successful_try_puts()

template<typename T, typename M = spin_rw_mutex>

bool internal::broadcast_cache< T, M >::gather_successful_try_puts | ( | const T & | t,
|  | task_list & | tasks
| ) |  |

inline

Definition at line 512 of file _flow_graph_cache_impl.h.

{
#endif // __TBB_PREVIEW_ASYNC_MSG
bool upgraded = true;
bool is_at_least_one_put_successful = false;
typename mutex_type::scoped_lock l(this->my_mutex, upgraded);
typename successors_type::iterator i = this->my_successors.begin();
while ( i != this->my_successors.end() ) {
task * new_task = (*i)->try_put_task(t);
if(new_task) {
++i;
if(new_task != SUCCESSFULLY_ENQUEUED) {
tasks.push_back(*new_task);
}
is_at_least_one_put_successful = true;
}
else { // failed
if ( (*i)->register_predecessor(*this->my_owner) ) {
if (!upgraded) {
l.upgrade_to_writer();
upgraded = true;
}
i = this->my_successors.erase(i);
} else {
++i;
}
}
}
return is_at_least_one_put_successful;
}

## try_put_task()

template<typename T, typename M = spin_rw_mutex>

task* internal::broadcast_cache< T, M >::try_put_task | ( | const T & | t | ) |

inline virtual

Implements internal::successor_cache< T, M >.

Definition at line 478 of file _flow_graph_cache_impl.h.

{
#endif // __TBB_PREVIEW_ASYNC_MSG
task * last_task = NULL;
bool upgraded = true;
typename mutex_type::scoped_lock l(this->my_mutex, upgraded);
typename successors_type::iterator i = this->my_successors.begin();
while ( i != this->my_successors.end() ) {
task *new_task = (*i)->try_put_task(t);
// workaround for icc bug
graph& graph_ref = (*i)->graph_reference();
last_task = combine_tasks(graph_ref, last_task, new_task); // enqueue if necessary
if(new_task) {
++i;
}
else { // failed
if ( (*i)->register_predecessor(*this->my_owner) ) {
if (!upgraded) {
l.upgrade_to_writer();
upgraded = true;
}
i = this->my_successors.erase(i);
} else {
++i;
}
}
}
return last_task;
}

Referenced by internal::continue_input< Output, Policy >::apply_body_bypass(), internal::function_input< Input, Output, Policy, Allocator >::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:

- _flow_graph_cache_impl.h

internal::successor_cache::my_mutex
mutex_type my_mutex
Definition: _flow_graph_cache_impl.h:277
tbb::flow::interface11::combine_tasks
static tbb::task * combine_tasks(graph &g, tbb::task *left, tbb::task *right)
Definition: flow_graph.h:191
tbb::flow::internal::SUCCESSFULLY_ENQUEUED
static tbb::task *const SUCCESSFULLY_ENQUEUED
Definition: _flow_graph_impl.h:61
task
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task * task
Definition: ittnotify_static.h:119
internal::successor_cache::my_successors
successors_type my_successors
Definition: _flow_graph_cache_impl.h:292

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.