Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
Go to the documentation of this file.
17 #ifndef __TBB_parallel_while
18 #define __TBB_parallel_while
20 #define __TBB_parallel_while_H_include_area
28 template<
typename Body>
34 template<
typename Stream,
typename Body>
class while_task;
39 template<
typename Body>
57 template<
typename Body>
72 if( ++k==
size )
break;
80 template<
typename Stream,
typename Body_>
friend class while_task;
86 template<
typename Stream,
typename Body>
93 block_type& t = *
new( allocate_additional_child_of(
my_barrier) ) block_type(
my_body);
95 while(
my_stream.pop_if_present(t.my_arg[k]) ) {
96 if( ++k==block_type::max_arg_size ) {
98 recycle_to_reexecute();
127 template<
typename Body>
148 template<
typename Stream>
149 void run( Stream& stream,
const Body& body );
160 template<
typename Body>
161 template<
typename Stream>
166 my_barrier = &barrier;
169 my_barrier->spawn_and_wait_for_all(w);
170 my_barrier->destroy(*my_barrier);
175 template<
typename Body>
177 __TBB_ASSERT(my_barrier,
"attempt to add to parallel_while that is not running");
179 iteration_type& i = *
new( task::allocate_additional_child_of(*my_barrier) ) iteration_type(item,*my_body);
186 #undef __TBB_parallel_while_H_include_area
while_group_task(const Body &body)
task * execute() __TBB_override
Should be overridden by derived classes.
parallel_while()
Construct empty non-running parallel while.
void spawn_and_wait_for_all(task &child)
Similar to spawn followed by wait_for_all, but more efficient.
task * execute() __TBB_override
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Body::argument_type my_value
Base class for user-defined tasks.
while_iteration_task(const typename Body::argument_type &value, const Body &body)
task * execute() __TBB_override
Should be overridden by derived classes.
static internal::allocate_root_proxy allocate_root()
Returns proxy for overloaded new that allocates a root task.
~parallel_while()
Destructor cleans up data members before returning.
static task &__TBB_EXPORTED_FUNC self()
The innermost task being executed or destroyed by the current thread at the moment.
void set_ref_count(int count)
Set reference count.
internal::allocate_child_proxy & allocate_child()
Returns proxy for overloaded new that allocates a child task of *this.
while_task(Stream &stream, const Body &body, empty_task &barrier)
static const size_t max_arg_size
void add(const value_type &item)
Add a work item while running.
Parallel iteration over a stream, with optional addition of more work.
Base class for types that should not be copied or assigned.
task that does nothing. Useful for synchronization.
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 value
Body::argument_type my_arg[max_arg_size]
void run(Stream &stream, const Body &body)
Apply body.apply to each item in the stream.
Body::argument_type value_type
Type of items.
void push_back(task &task)
Push task onto back of list.
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.