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: 2526

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: 1315

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: 2644

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: 1156

Promise and Future

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

Read more
Tags: tasks
Comments 3Views: 3533

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: 3673

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 6Views: 3967

My Newest E-Book

Latest comments

Subscribe to the newsletter (+ pdf bundle)

Blog archive

Source Code

Visitors

Today 222

All 257842

Currently are 232 guests and no members online