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
1
vote
0 answers

Why should I ever use concurrency::critical section in place of other locking mechanisms

I'm using concurrency::parallel_for() in a Windows app (Visual Studio 2017) to divide up some work in a loop. Everything worked just fine but I was concerned about locking performance so i tried various methods: std::mutex, windows…
Joe
  • 5,394
  • 3
  • 23
  • 54
1
vote
1 answer

'Concurrency': a namespace with this name does not exist

I am an amateur C# programmer who strayed into C++ because of a need for the C++ AMP technology for some heavy-duty number crunching. Hence, my C++ programming skills are not very well developed. For my first attempt at an actual program, I chose…
JackG
  • 25
  • 6
1
vote
2 answers

How to handle exceptions from StorageFile::OpenAsync when URI is bad

I have a section of code that correctly load images from http URIs when the URIs are valid but I cannot figure how to catch the exception OpenAsync throws when the URI is invalid (results in 404). The problem is that when the lambda which contains…
0
votes
1 answer

Number of messages in 'unbounded_buffer'

The class Concurrency::unbounded_buffer can store any number of messages. But how to know number of pending (not received) messages?
0
votes
0 answers

What types can be used with the concurrency::task class template?

I'm trying to return a custom type from a Concurrency Runtime task. My custom type should be constructible through a static factory method only (aside from being move-constructible), e.g.: #include struct foo { foo() = delete; …
IInspectable
  • 46,945
  • 8
  • 85
  • 181
0
votes
2 answers

How to compose asynchronous operations?

I'm looking for a way to compose asynchronous operations. The ultimate goal is to execute an asynchronous operation, and either have it run to completion, or return after a user-defined timeout. For exemplary purposes, assume that I'm looking for a…
IInspectable
  • 46,945
  • 8
  • 85
  • 181
0
votes
0 answers

PPL. How do i schedule several tasks on same worker thread?

I need to know how i can control on which worker thread Concurrency::task will run. Imagine if i have following code: #include #include #include int main() { std::mutex mtx; Concurrency::create_task([&mtx] …
Alexander
  • 959
  • 5
  • 11
  • 29
0
votes
1 answer

Windows concurrency runtime task scheduling with exceptions

According to MSDN, A task-based continuation is always scheduled for execution when the antecedent task finishes, even when the antecedent task is canceled or throws an exception. I don't understand this because I tried out the following code and…
Michael Kiros
  • 563
  • 4
  • 11
0
votes
1 answer

Analyze concurency::task() API & why do we need this?

I'm, trying to understand the syntax of the concurrency::task in the below code snippet. I'm unable to understand this code snippet syntax. How do we analyze this: What is "getFileOperation" here. Is it an object of type StorageFile class ? …
codeLover
  • 3,720
  • 10
  • 65
  • 121
0
votes
1 answer

Concurrency::critical_section build error: cannot access private member

I can't build below code(vs2013) blocks and getting error "error C2248: 'Concurrency::critical_section::critical_section' : cannot access private member declared in class 'Concurrency::critical_section'" Anyone can help explain why this is…
Xin
  • 575
  • 4
  • 20
0
votes
1 answer

how to handle this situation of deadlock in dot net

suppose, I am having the application for movie seat reservation. scenario is, 3 different request comes at system at exact same time. neither the difference in milliseconds also... How to handle the request? how to define the critical section and…
Red Swan
  • 15,157
  • 43
  • 156
  • 238
0
votes
1 answer

task-concatenation in WinRT, why cannot use task::wait?

In my current project I have had a recent issue and have trouble understanding it: concurrency::create_task(BPClient->ReadAnswer()).then([this](Windows::Foundation::Collections::IVector^ Vec) { …
bash.d
  • 13,029
  • 3
  • 29
  • 42
0
votes
1 answer

Periodic task with ConcRT

I am writing a C++ application that, among other duties, periodically (once in hour) makes requests to server. This scheduled task can be interrupted and forced to execute earlier (when application receives new user data). I've decided to use…
Andrew S
  • 23
  • 5
0
votes
1 answer

Using VS2010 concurrency runtime message passing classes (unbounded_buffer, etc) on non-runtime threads

I like the convenience of unbounded_buffer, but I also want to use this class on threads that concurrency runtime knows nothing about. In my tests it seems to work fine. Any potential problems with this approach?
-1
votes
1 answer

Concurrency, tasks

I'm new to the Microsoft Concurrency Runtime (and asynchronous programming in general), and I'm trying to understand what can and can't be done with it. Is it possible to create a task group such that the tasks execute in the order in which they…
RobertF
  • 1
  • 2
1
2