21 #ifndef __TBB_flow_graph_impl_H 22 #define __TBB_flow_graph_impl_H 24 #include "../tbb_stddef.h" 26 #include "../task_arena.h" 27 #include "../flow_graph_abstractions.h" 31 #if TBB_DEPRECATED_FLOW_ENQUEUE 32 #define FLOW_SPAWN(a) tbb::task::enqueue((a)) 34 #define FLOW_SPAWN(a) tbb::task::spawn((a)) 44 namespace interface10 {
51 template <
typename GraphContainerType,
typename GraphNodeType>
141 template<
typename Body >
153 template<
typename Receiver,
typename Body >
211 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 212 void set_name(
const char *
name);
236 template< typename Receiver, typename Body >
237 void run(Receiver &r, Body body) {
239 task* rtask =
new (task::allocate_additional_child_of(*
root_task()))
248 template<
typename Body >
262 #if TBB_USE_EXCEPTIONS 267 #if TBB_USE_EXCEPTIONS 293 template<
typename C,
typename N>
352 template<
typename C,
typename N>
362 #if TBB_PREVIEW_FLOW_GRAPH_TRACE 363 virtual void set_name(
const char *
name) = 0;
366 #if TBB_DEPRECATED_FLOW_NODE_EXTRACTION 367 virtual void extract() = 0;
414 #endif // __TBB_flow_graph_impl_H void run(Body body)
Spawns a task that runs a function object.
tbb::task * execute() __TBB_override
Should be overridden by derived classes.
void set_ref_count(int count)
Set reference count.
const GraphNodeType & const_reference
graph()
Constructs a graph with isolated task_group_context.
std::list< tbb::task * > task_list_type
void activate_graph(graph &g)
void spawn_in_graph_arena(graph &g, tbb::task &arena_task)
Spawns a task inside graph arena.
void reserve_wait() __TBB_override
Used to register that an external entity may still interact with the graph.
Base class for user-defined tasks.
bool is_cancelled()
return status of graph execution
Pure virtual template classes that define interfaces for async communication.
bool operator==(const graph_iterator &other) const
Equality.
A lock that occupies a single byte.
Base class for types that should not be copied or assigned.
tbb::task_group_context * my_context
graph_iterator & operator=(const graph_iterator &other)
Assignment.
void register_node(graph_node *n)
reference operator *() const
Dereference.
GraphNodeType & reference
void decrement_wait_count()
void wait_for_all()
Wait for reference count to become one, and set reference count to zero.
iterator begin()
start iterator
tbb::spin_mutex nodelist_mutex
void __TBB_EXPORTED_METHOD reset()
Forcefully reinitializes the context after the task tree it was associated with is completed.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
The base of all graph nodes.
tbb::task * execute() __TBB_override
Should be overridden by derived classes.
Tag class used to indicate the "attaching" constructor.
tbb::task * graph_root_task
Base class for types that should not be assigned.
void execute_in_graph_arena(graph &g, F &f)
Executes custom functor inside graph arena.
graph_iterator< graph, graph_node > iterator
task_list_type my_reset_task_list
graph_node * my_nodes_last
void remove_node(graph_node *n)
void deactivate_graph(graph &g)
const_iterator cend() const
end const iterator
graph_iterator(const graph_iterator &other)
Copy constructor.
Used to form groups of tasks.
void wait_for_all()
Wait until graph is idle and decrement_wait_count calls equals increment_wait_count calls.
bool is_graph_active(graph &g)
void increment_wait_count()
GraphContainerType * my_graph
virtual void reset_node(reset_flags f=rf_reset_protocol)=0
graph_iterator operator++(int)
Post-increment.
graph_iterator & operator++()
Pre-increment.
graph_iterator< const graph, const graph_node > const_iterator
void initialize()
Forces allocation of the resources for the task_arena as specified in constructor arguments.
std::forward_iterator_tag iterator_category
void release_wait() __TBB_override
Deregisters an external entity that may have interacted with the graph.
run_and_put_task(Receiver &r, Body &body)
pointer operator->() const
Dereference.
wait_functor(tbb::task *t)
internal::return_type_or_void< F >::type execute(F &f)
void run(Receiver &r, Body body)
Spawns a task that runs a body and puts its output to a specific receiver.
iterator end()
end iterator
void add_task_to_graph_reset_list(graph &g, tbb::task *tp)
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 begin
void reset(reset_flags f=rf_reset_protocol)
const_iterator cbegin() const
start const iterator
spawn_functor(tbb::task &t)
uintptr_t traits() const
Returns the context's trait.
tbb::task * root_task()
Returns the root task of the graph.
graph_iterator()
Default constructor.
A functor that spawns a task.
~graph()
Destroys the graph.
tbb::task_arena * my_task_arena
void const char const char int ITT_FORMAT __itt_group_sync x void const char * name
static tbb::task *const SUCCESSFULLY_ENQUEUED
void prepare_task_arena(bool reinit=false)
bool operator!=(const graph_iterator &other) const
Inequality.
bool __TBB_EXPORTED_METHOD is_group_execution_cancelled() const
Returns true if the context received cancellation request.