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

262  {
263  // This (T) is async and incoming 'X t' is NOT async
264  // Create async_msg for X

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

257  {
258  if (is_async) {
259  // Both are async

◆ 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<T*>(static_cast<async_msg<filtered_type>*>(p));
254  }
void const char const char int ITT_FORMAT __itt_group_sync p

◆ 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<void*>(&static_cast<async_msg<filtered_type>&>(t));
245  }
246 
247  // Sender-classes use non-const interfaces

◆ 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  if (is_async) {
215  // This (T) is NOT async and incoming 'A<X> t' IS async
216  // Get data from async_msg
217  const async_msg<filtered_type>& msg = async_helpers< async_msg<filtered_type> >::from_void_ptr(p);
218  task* const new_task = msg.my_storage->subscribe(*this_recv, this_recv->graph_reference());
219  // finalize() must be called after subscribe() because set() can be called in finalize()
220  // and 'this_recv' client must be subscribed by this moment
221  msg.finalize();
222  return new_task;
223  }
224  else {
225  // Incoming 't' is NOT async
226  return this_recv->try_put_task(from_void_ptr(p));
227  }
228  }
229 };
230 
231 template< typename T >
232 struct async_helpers< T, typename std::enable_if< std::is_base_of<async_msg<typename T::async_msg_data_type>, T>::value >::type > {
233  typedef T async_type;
234  typedef typename T::async_msg_data_type filtered_type;
235 
236  static const bool is_async_type = true;
237 
238  // Receiver-classes use const interfaces
239  static const void* to_void_ptr(const T& t) {
240  return static_cast<const void*>(&static_cast<const async_msg<filtered_type>&>(t));
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
virtual void finalize() const
async_storage_ptr my_storage
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

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.