Questions tagged [ppl]

The Parallel Patterns Library (PPL) is a C++ library included with Microsoft Visual C++ 2010+ that provides an imperative programming model that promotes scalability and ease-of-use for developing concurrent applications.

The Parallel Patterns Library (PPL) is a C++ library included with Microsoft Visual C++ 2010+ that provides an imperative programming model that promotes scalability and ease-of-use for developing concurrent applications.

142 questions
4
votes
1 answer

How do I create concurrency::task from result?

I want to create a new task that is already completed from the given result. My current workaround is: return concurrency::task([]{return result;}); Is there anything better? The problem is with the following code: concurrency::task
Toni Petrina
  • 7,014
  • 1
  • 25
  • 34
4
votes
1 answer

PPL Task - Continuation in UI thread for desktop application

I would like to use a ppl task to do some work in the background, and, upon completion, show the result in a window. In my case the UI-framework is MFC. The structure would be: using namespace concurrency; create_task([] { // this can be run in…
sorrymissjackson
  • 2,395
  • 1
  • 19
  • 18
4
votes
0 answers

WinRT WRL WinRtClassicComMix and IAsyncOperation fails

I have a C++ WinRT component which is a WinRtClassicComMix. I want to define a method which returns a custom class through an IAsyncOperation to the calling C# or WinJS code. All is working fine when an IAsyncAction is used with no return value,…
Rene Schulte
  • 2,962
  • 1
  • 19
  • 26
4
votes
0 answers

Can process termination be prevented when multiple sub-tasks of a `when_all` throw uncaught exceptions?

The Concurrency Runtime detects when exceptions thrown by tasks cannot be handled and "fails fast"; that is, it terminates the process. I have a case where multiple sub-tasks given to a when_all may throw exceptions. Ideally, I'd like these…
kring
  • 286
  • 1
  • 3
4
votes
2 answers

Task continuations in Intel TBB

Is there anything similar to PPL's task continuations in TBB? I am aware of the low level TBB method of manuall allocating tbb::tasks and manually allocating continuation tasks too and managing ref counts manually for them: struct FibContinuation:…
Ed Rowlett-Barbu
  • 1,611
  • 10
  • 27
3
votes
1 answer

Converting a task to task

Is there a way to simplify the following code to avoid the .then call that "converts" my task to task? I can't change the function signature of MyClass::MyFunction1 because it's a part of a public API. task MyClass::MyFunction1() { …
K Mehta
  • 10,323
  • 4
  • 46
  • 76
3
votes
2 answers

Is there a awaitable queue in c++?

I use concurrency::task from ppltasks.h heavily in my codebase. I would like to find a awaitable queue, where I can do "co_await my_queue.pop()". Has anyone implemented one? Details: I have one producer thread that pushes elements to a queue, and…
petke
  • 1,345
  • 10
  • 25
3
votes
1 answer

How to catch exceptions from multiple tasks in Casablanca

I'm trying to join two pplx tasks using the && operator of task, where both sub tasks can throw exceptions. I understand from the ppl documentation that I can catch an exception in a final, task-based continuation. This works in Casablanca as…
hrantzsch
  • 353
  • 2
  • 7
3
votes
0 answers

Define the number of cores in concurrency::parallel_for

I am using concurrency::parallel_for from ppl.h (Windows). Can I specify the number of cores that the must be used? or at least the max number of cores?
Humam Helfawi
  • 19,566
  • 15
  • 85
  • 160
3
votes
3 answers

Task execution properties in ppl

Does newly created task from C++ ppl library executes automatically or is there any mechanism needed in order to initiate the execution of aforementioned task?
Artur
  • 181
  • 1
  • 9
3
votes
1 answer

PPL when_all with tasks of different types?

I'd like to use PPL "when_all" on tasks with different types. And add a "then" call to that task. But when_all returns task that takes a vector, so all elements have to be the same type. So how do I do this? This is what I have come up with but it…
petke
  • 1,345
  • 10
  • 25
3
votes
1 answer

Why is PPL significantly slower than sequential loop and OpenMP in this case

Further to my question on CodeReview, I am wondering why the PPL implementation of a simple transform of two vectors using std::plus was so much slower than the sequential std::transform and using a for loop with OpenMP (sequential (with…
Thomas Russell
  • 5,870
  • 4
  • 33
  • 68
3
votes
3 answers

Microsoft VC++ PPL and sleeping

Following program runs differently depending on the sleep mechanism used. #include #include #include #include #include #include using namespace std; #define MODERN_MAN int main() { …
NoSenseEtAl
  • 28,205
  • 28
  • 128
  • 277
3
votes
2 answers

In VC++ PPL, how do I create a task-returning method that returns synchronously?

Consider the following C# code: async Task DoSomethingAsync() { if (m_f) return; await DoSomethingInternalAsync(); } What the compiler turns this into is a task returning call where if m_f is true, the task completes immediately and if not, it…
Shahar Prish
  • 4,838
  • 3
  • 26
  • 47
3
votes
2 answers

execute .then without delay

Since C++11 doesn't have a future.then I've started using concurrency::task from the Microsoft PPL library. It works great most of the time. However, right now I'm in a situation where I'm doing GPGPU, so having .then continuations scheduled in the…
ronag
  • 49,529
  • 25
  • 126
  • 221
1
2
3
9 10