Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

combinable Class

The combinable<T> object is intended to provide thread-private copies of data, to perform lock-free thread-local sub-computations during parallel algorithms. At the end of the parallel operation, the thread-private sub-computations can then be merged into a final result. This class can be used instead of a shared variable, and can result in a performance improvement if there would otherwise be a lot of contention on that shared variable.

template<
   typename _Ty
>
class combinable;
_Ty

The data type of the final merged result. The type must have a copy constructor and a default constructor.

Name

Description

combinable::combinable Constructor

Overloaded. Constructs a new combinable object.

combinable::~combinable Destructor

Destroys a combinable object.

Name

Description

combinable::clear Method

Clears any intermediate computational results from a previous usage.

combinable::combine Method

Computes a final value from the set of thread-local sub-computations by calling the supplied combine functor.

combinable::combine_each Method

Computes a final value from the set of thread-local sub-computations by calling the supplied combine functor once per thread-local sub-computation. The final result is accumulated by the function object.

combinable::local Method

Overloaded. Returns a reference to the thread-private sub-computation.

Name

Description

combinable::operator= Operator

Assigns to a combinable object from another combinable object.

Header: ppl.h

Namespace: concurrency

Show:
© 2014 Microsoft. All rights reserved.