tasks

std::future Extensions

Tasks in the form of promises and futures have in C++11 an ambivalent reputation. At on hand, they are a lot easier to use than threads or condition variables; at the other hand, they have a great deficiency. They can not composed. C++20 will overcome this deficiency.

Read more
Tags: C++20, tasks
Add CommentViews: 2212

Multithreaded: Summation with Minimal Synchronization

Until now I've used two strategies for the summation of a std::vector. First I did the whole math in one thread (Single Threaded: Summation of a vector); second multiple threads shared the same variable for the result (Multithreaded: Summation of a vector). In particular the second strategy was extremely naive. In this post I will apply my knowledge of both posts. My goal is it that the thread will perform their summation as independent form each other as possible and therefore reduce the synchronization overhead. 

Read more
Comments 4Views: 1207

Thread Synchronization with Condition Variables or Tasks

In case you are using  promise and future to synchronize threads, they have a lot in common with condition variables. But most of the time, task are the better choice.

Read more
Comments 21Views: 2372

The Special Futures

The parent of a thread has to take care of its child. The parent can wait, until its child is done or detach itself from its child. But that is not really new. But that will not hold for std::async. The big charm of std::async is, that the parent has not take to care of its child.

Read more
Tags: async, tasks
Add CommentViews: 1042

Promise and Future

With std::promise and std::future, you have the full control over the task.

Read more
Tags: tasks
Comments 3Views: 3266

Asynchronous Callable Wrappers

std::packaged_task enables you to write a simple wrapper for a callable, which you can invoke later.

Read more
Tags: tasks
Comments 19Views: 3435

Asynchronous Function Calls

std:.async feels like an asynchronous function call. Under the hood std::async is a task. One, which is extremely easy to use.

Read more
Tags: async, tasks
Comments 5Views: 3571

Support my blog by buying my E-book

Latest comments

Modernes C++

Subscribe to the newsletter

Including two chapters of my e-book
Introduction and Multithreading

Blog archive

Source Code

Visitors

Today 2131

All 228145

Currently are 162 guests and no members online