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

An cache of predecessors that supports requests and reservations. More...

#include <flow_graph.h>

Inheritance diagram for tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >:
Collaboration diagram for tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >:

Public Types

typedef M mutex_type
 
typedef T output_type
 
typedef untyped_sender predecessor_type
 
typedef untyped_receiver successor_type
 
- Public Types inherited from tbb::flow::interface10::internal::predecessor_cache< T, M >
typedef M mutex_type
 
typedef T output_type
 
typedef untyped_sender predecessor_type
 
typedef untyped_receiver successor_type
 
- Public Types inherited from tbb::flow::interface10::internal::node_cache< untyped_sender, M >
typedef size_t size_type
 

Public Member Functions

 reservable_predecessor_cache ()
 
bool try_reserve (output_type &v)
 
bool try_release ()
 
bool try_consume ()
 
void reset ()
 
void clear ()
 
- Public Member Functions inherited from tbb::flow::interface10::internal::predecessor_cache< T, M >
 predecessor_cache ()
 
void set_owner (successor_type *owner)
 
bool get_item (output_type &v)
 
void reset ()
 
- Public Member Functions inherited from tbb::flow::interface10::internal::node_cache< untyped_sender, M >
bool empty ()
 
void add (untyped_sender &n)
 
void remove (untyped_sender &n)
 
void clear ()
 

Private Attributes

predecessor_typereserved_src
 

Additional Inherited Members

- Protected Types inherited from tbb::flow::interface10::internal::node_cache< untyped_sender, M >
typedef M mutex_type
 
- Protected Member Functions inherited from tbb::flow::interface10::internal::node_cache< untyped_sender, M >
bool internal_empty ()
 
size_type internal_size ()
 
void internal_push (untyped_sender &n)
 
untyped_senderinternal_pop ()
 
- Protected Attributes inherited from tbb::flow::interface10::internal::predecessor_cache< T, M >
successor_typemy_owner
 
- Protected Attributes inherited from tbb::flow::interface10::internal::node_cache< untyped_sender, M >
mutex_type my_mutex
 
std::queue< untyped_sender * > my_q
 

Detailed Description

template<typename T, typename M = spin_mutex>
class tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >

An cache of predecessors that supports requests and reservations.

Definition at line 111 of file flow_graph.h.

Member Typedef Documentation

◆ mutex_type

template<typename T, typename M = spin_mutex>
typedef M tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::mutex_type

Definition at line 200 of file flow_graph.h.

◆ output_type

template<typename T, typename M = spin_mutex>
typedef T tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::output_type

Definition at line 201 of file flow_graph.h.

◆ predecessor_type

template<typename T, typename M = spin_mutex>
typedef untyped_sender tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::predecessor_type

Definition at line 203 of file flow_graph.h.

◆ successor_type

template<typename T, typename M = spin_mutex>
typedef untyped_receiver tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::successor_type

Definition at line 204 of file flow_graph.h.

Constructor & Destructor Documentation

◆ reservable_predecessor_cache()

template<typename T, typename M = spin_mutex>
tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::reservable_predecessor_cache ( )
inline

Definition at line 210 of file flow_graph.h.

213 {

Member Function Documentation

◆ clear()

template<typename T, typename M = spin_mutex>
void tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::clear ( )
inline

Definition at line 261 of file flow_graph.h.

261  {
262  if (is_async) {
263  // Both are async
264  return this_recv->try_put_task(from_void_ptr(p));
void const char const char int ITT_FORMAT __itt_group_sync p

Referenced by tbb::flow::interface11::limiter_node< T, DecrementType >::reset_node().

Here is the caller graph for this function:

◆ reset()

template<typename T, typename M = spin_mutex>
void tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::reset ( )
inline

Definition at line 256 of file flow_graph.h.

256  {
257  return *static_cast<T*>(static_cast<async_msg<filtered_type>*>(p));
258  }
259 
void const char const char int ITT_FORMAT __itt_group_sync p

Referenced by tbb::flow::interface11::limiter_node< T, DecrementType >::reset_node().

Here is the caller graph for this function:

◆ try_consume()

template<typename T, typename M = spin_mutex>
bool tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::try_consume ( )
inline

Definition at line 250 of file flow_graph.h.

252  {
253  return *static_cast<const T*>(static_cast<const async_msg<filtered_type>*>(p));
254  }
void const char const char int ITT_FORMAT __itt_group_sync p

Referenced by tbb::flow::interface11::limiter_node< T, DecrementType >::forward_task().

Here is the caller graph for this function:

◆ try_release()

template<typename T, typename M = spin_mutex>
bool tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::try_release ( )
inline

Definition at line 243 of file flow_graph.h.

243  {
244  return static_cast<const void*>(&static_cast<const async_msg<filtered_type>&>(t));
245  }
246 
247  static void* to_void_ptr(T& t) {

Referenced by tbb::flow::interface11::limiter_node< T, DecrementType >::forward_task().

Here is the caller graph for this function:

◆ try_reserve()

template<typename T, typename M = spin_mutex>
bool tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::try_reserve ( output_type v)
inline

Definition at line 213 of file flow_graph.h.

213  {
214  return *static_cast<T*>(p);
215  }
216 
217  static task* try_put_task_wrapper_impl(receiver<T>* const this_recv, const void *p, bool is_async) {
218  if (is_async) {
219  // This (T) is NOT async and incoming 'A<X> t' IS async
220  // Get data from async_msg
221  const async_msg<filtered_type>& msg = async_helpers< async_msg<filtered_type> >::from_void_ptr(p);
222  task* const new_task = msg.my_storage->subscribe(*this_recv, this_recv->graph_reference());
223  // finalize() must be called after subscribe() because set() can be called in finalize()
224  // and 'this_recv' client must be subscribed by this moment
225  msg.finalize();
226  return new_task;
227  }
228  else {
229  // Incoming 't' is NOT async
230  return this_recv->try_put_task(from_void_ptr(p));
231  }
232  }
233 };
234 
235 template< typename T >
236 struct async_helpers< T, typename std::enable_if< std::is_base_of<async_msg<typename T::async_msg_data_type>, T>::value >::type > {
237  typedef T async_type;
238  typedef typename T::async_msg_data_type filtered_type;
239 
240  static const bool is_async_type = true;
async_storage_ptr my_storage
virtual void finalize() const
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 const char const char int ITT_FORMAT __itt_group_sync p
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 ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type

Referenced by tbb::flow::interface11::limiter_node< T, DecrementType >::forward_task().

Here is the caller graph for this function:

Member Data Documentation

◆ reserved_src

template<typename T, typename M = spin_mutex>
predecessor_type* tbb::flow::interface10::internal::reservable_predecessor_cache< T, M >::reserved_src
private

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