17 #ifndef __TBB_parallel_while 18 #define __TBB_parallel_while 25 template<
typename Body>
31 template<
typename Stream,
typename Body>
class while_task;
36 template<
typename Body>
54 template<
typename Body>
69 if( ++k==
size )
break;
77 template<
typename Stream,
typename Body_>
friend class while_task;
83 template<
typename Stream,
typename Body>
90 block_type& t = *
new( allocate_additional_child_of(
my_barrier) ) block_type(
my_body);
92 while(
my_stream.pop_if_present(t.my_arg[k]) ) {
93 if( ++k==block_type::max_arg_size ) {
124 template<
typename Body>
145 template<
typename Stream>
146 void run( Stream& stream,
const Body& body );
157 template<
typename Body>
158 template<
typename Stream>
160 using namespace internal;
163 my_barrier = &barrier;
167 my_barrier->destroy(*my_barrier);
172 template<
typename Body>
174 __TBB_ASSERT(my_barrier,
"attempt to add to parallel_while that is not running");
175 typedef internal::while_iteration_task<Body> iteration_type;
176 iteration_type& i = *
new( task::allocate_additional_child_of(*my_barrier) ) iteration_type(item,*my_body);
void spawn_and_wait_for_all(task &child)
Similar to spawn followed by wait_for_all, but more efficient.
Parallel iteration over a stream, with optional addition of more work.
parallel_while()
Construct empty non-running parallel while.
static const size_t max_arg_size
while_group_task(const Body &body)
task that does nothing. Useful for synchronization.
task * execute() __TBB_override
Should be overridden by derived classes.
internal::allocate_child_proxy & allocate_child()
Returns proxy for overloaded new that allocates a child task of *this.
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
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
void push_back(task &task)
Push task onto back of list.
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.
Base class for user-defined tasks.
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.
void recycle_to_reexecute()
Schedule this for reexecution after current execute() returns.
void run(Stream &stream, const Body &body)
Apply body.apply to each item in the stream.
Body::argument_type my_value
task * execute() __TBB_override
Should be overridden by derived classes.
void add(const value_type &item)
Add a work item while running.
Body::argument_type my_arg[max_arg_size]
while_iteration_task(const typename Body::argument_type &value, const Body &body)
while_task(Stream &stream, const Body &body, empty_task &barrier)
Body::argument_type value_type
Type of items.
task * execute() __TBB_override
Should be overridden by derived classes.