开发者

Analong of Concurrency::combinable<T> in C#?

Is there any way of duplicating the functionality found within the combinable data structure within C++ in C#?

In C++ I could do something along the lines of:

Concurrency::combinable<CustomData> c;
Concurrency::parallel_for(0, size, [&](int i)
{
    CustomData cd = some_operation(i);
    c.local() += cd;
});
c.combine([](CustomData a, CustomData b) { return a + b; });

Where CustomData is some arbitrary data that has a well def开发者_如何学编程ined addition operator.

Any help would be much appreciated!


check out PLINQ and the Aggregate method. it's awesome. http://msdn.microsoft.com/en-us/library/dd460697.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜