Questions tagged [concurrency-runtime]

Parallel programming library from Microsoft. Supported on Visual C++ 2010 and above compilers.

The Concurrency Runtime programming framework for C++ helps you write robust, scalable, and responsive parallel applications. It raises the level of abstraction so that you do not have to manage the infrastructure details that are related to concurrency. You can also use it to specify scheduling policies that meet the quality of service demands of your applications. The following documents can help you start working with the Concurrency Runtime.

30 questions
6
votes
0 answers

Using Concurrency::concurrent_queue together with std::unique_ptr

I want to use the Concurrency library of Visual Studio 2010 to pass actions between threads. I have my class SimpleAction and pointers to it are stored in the Concurrency::concurrent_queue. Using this definition, and 'consumption' logic it…
Patrick
  • 23,217
  • 12
  • 67
  • 130
6
votes
1 answer

Implementing task-local variables for Concurrency Runtime

I'm improving an application (Win64, C++) by making it more asynchronous. I'm using the Concurrency Runtime and it's worked great for me so far. The application basically executes a number of 'jobs' transforming data. To track what each job does,…
5
votes
1 answer

Asynchronous Agents and window messages

I'm currently playing with the Asynchronous Agents Library in Microsoft's Concurrency Runtime. I have not yet found an obvious way to signal that a task is finished by using window messages, or some other means of notifying the UI thread that the…
Jörgen Sigvardsson
  • 4,839
  • 3
  • 28
  • 51
5
votes
1 answer

concurrency::task destructor causes call to abort in valid use-case

Could you please tell me if the approach I use to handle the use-case is invalid and if so, what is the right way to handle: task do_work(int param) { // runs some work on a separate thread, returns task with result or throws exception on…
topoden
  • 111
  • 1
  • 5
4
votes
1 answer

how to tell the c++ concurrency runtime to reuse the previous thread for task continuations

I used the visual c++ concurrency runtime to create a task and then scheduled four continuations on it #include #include #include int main() { concurrency::create_task([] { std::cout <<…
tcb
  • 4,408
  • 5
  • 34
  • 51
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
1 answer

Why do I have the option to *not* call Concurrency::agent::done inside run?

This is in the context of the Microsoft C++ Concurrency API. There's a class called agent (under Concurrency namespace), and it's basically a state machine you derive and implement pure virtual agent::run. Now, it is your responsibility to call…
Matthew Reddington
  • 1,409
  • 3
  • 13
  • 24
3
votes
2 answers

What are the limitations of MS Concurrency Runtime?

I am using a simple Concurrency Runtime task_group in Visual Studio 2010 to run a single working thread to separate the work from the GUI thread. However one of my colleagues told me that I'm using CR wrong: it was designed for parallelizing…
Steed
  • 1,292
  • 1
  • 14
  • 33
3
votes
1 answer

VS2010's concurency runtime and unbounded_buffer>, any pitfalls?

I want to pass heap-allocated objects from a dll. Obviously, memory must be managed correctly. Does anyone see a problem with the following cunning scheme I devised: unbounded_buffer> buf; I am aware that shared_ptr stashes away a…
2
votes
2 answers

C++ Wait But Allow Events To Fire

Building a SignalR C++ client using Visual Studio 2013, I am starting with the working sample code from NuGet Package Microsoft.AspNet.SignalR.Client.Cpp.v120.WinDesktop, source here Reviewing the library source it seems to me the event handling…
Malcolm McCaffery
  • 2,468
  • 1
  • 22
  • 43
2
votes
1 answer

What does "unit of execution" mean?

Wikipedia defines an execution unit as: "In computer engineering, an execution unit (also called a functional unit) is a part of a CPU that performs the operations and calculations called for by the computer program." Now, is it a logical or…
Solace
  • 8,612
  • 22
  • 95
  • 183
2
votes
0 answers

Is the concurrency::task<_ty> assignment operator thread-safe?

task t = [] { //do something }; void post(std::function tExecute) { t = t.then(tExecute); } I am trying to create a strand using the above code, where multiple threads can call post to ensure sequential processing of some…
aamir
  • 151
  • 6
2
votes
1 answer

ConcRT synchronization structures vs Standard Library

If my application targets Windows and already uses Concurrency Runtime in some of it's parts. Is there any advantages/disadvantages of using ConcRT synchronization structures (concurrency:critical_section) over standard library implementation…
Andrew S
  • 23
  • 5
2
votes
2 answers

Exception handling, WinRT C++ concurrency async tasks

I have to implement an async HTTP GET in C++ and we have to be able to submit the app to the Windows 8 Store. My problem is the following: I've found a suitable Sample code which implements an HttpRequest class…
Viktor Benei
  • 3,447
  • 2
  • 28
  • 37
1
vote
0 answers

What does the concurrency::task destructor do?

The documentation for concurrency::task says: When a task object is assigned to a new variable, the behavior is that of std::shared_ptr; in other words, both objects represent the same underlying task. So when the task is destructed, and no other…
MHebes
  • 2,290
  • 1
  • 16
  • 29
1
2