Intel(R) Threading Building Blocks Doxygen Documentation version 4.2.3
Loading...
Searching...
No Matches
internal::round_robin_cache< T, M > Class Template Reference

A cache of successors that are put in a round-robin fashion. More...

#include <_flow_graph_cache_impl.h>

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

Public Member Functions

 round_robin_cache ()
 
size_type size ()
 
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 ()
 
virtual tasktry_put_task (const T &t)=0
 

Private Types

typedef size_t size_type
 
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::round_robin_cache< T, M >

A cache of successors that are put in a round-robin fashion.

Definition at line 546 of file _flow_graph_cache_impl.h.

Member Typedef Documentation

◆ mutex_type

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

Definition at line 548 of file _flow_graph_cache_impl.h.

◆ size_type

template<typename T , typename M = spin_rw_mutex>
typedef size_t internal::round_robin_cache< T, M >::size_type
private

Definition at line 547 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::round_robin_cache< T, M >::successors_type
private

Definition at line 549 of file _flow_graph_cache_impl.h.

Constructor & Destructor Documentation

◆ round_robin_cache()

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

Definition at line 553 of file _flow_graph_cache_impl.h.

553{}

Member Function Documentation

◆ size()

template<typename T , typename M = spin_rw_mutex>
size_type internal::round_robin_cache< T, M >::size ( )
inline

Definition at line 555 of file _flow_graph_cache_impl.h.

555 {
556 typename mutex_type::scoped_lock l(this->my_mutex, false);
557 return this->my_successors.size();
558 }

◆ try_put_task()

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

Implements internal::successor_cache< T, M >.

Definition at line 564 of file _flow_graph_cache_impl.h.

564 {
565#endif // __TBB_PREVIEW_ASYNC_MSG
566 bool upgraded = true;
567 typename mutex_type::scoped_lock l(this->my_mutex, upgraded);
568 typename successors_type::iterator i = this->my_successors.begin();
569 while ( i != this->my_successors.end() ) {
570 task *new_task = (*i)->try_put_task(t);
571 if ( new_task ) {
572 return new_task;
573 } else {
574 if ( (*i)->register_predecessor(*this->my_owner) ) {
575 if (!upgraded) {
576 l.upgrade_to_writer();
577 upgraded = true;
578 }
579 i = this->my_successors.erase(i);
580 }
581 else {
582 ++i;
583 }
584 }
585 }
586 return NULL;
587 }
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 task.


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.