# tbb::parallel_while< Body > Class Template Reference
[Algorithms]

`#include <parallel_while.h>`

List of all members.

## Public Types
typedef Body::argument_type | value_type
| Type of items.
## Public Member Functions
| parallel_while ()
| Construct empty non-running parallel while.
| ~parallel_while ()
| Destructor cleans up data members before returning.
template<typename Stream >
void | run (Stream &stream, const Body &body)
| Apply body.apply to each item in the stream.
void | add (const value_type &item)
| Add a work item while running.

## Detailed Description

### template<typename Body>
class tbb::parallel_while< Body >

Parallel iteration over a stream, with optional addition of more work. The Body b has the requirement:
"b(v)"
"b.argument_type"
where v is an argument_type

## Member Function Documentation

template<typename Body >

void tbb::parallel_while< Body >::add | ( | const value_type & | item | ) | `[inline]`

Add a work item while running.

Should be executed only by body.apply or a thread spawned therefrom.

References tbb::task::self().

template<typename Body >
template<typename Stream >

void tbb::parallel_while< Body >::run | ( | Stream & | stream,
|  | const Body & | body |
| ) |  |  | `[inline]`

Apply body.apply to each item in the stream.

A Stream s has the requirements
"S::value_type"
s.pop_if_present(value) is convertible to bool

References tbb::task::allocate_child(), tbb::task::allocate_root(), tbb::task::destroy(), tbb::task::set_ref_count(), and tbb::task::spawn_and_wait_for_all().

The documentation for this class was generated from the following file:

- parallel_while.h

Copyright © 2005-2013 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.