From the course: Functional Programming in C++
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Handling concurrent tasks in a functional manner - C++ Tutorial
From the course: Functional Programming in C++
Handling concurrent tasks in a functional manner
- [Instructor] Welcome to this example. In it we're going to explore concurrent tasks in C++ done functionally. So let's take a look at our code to see where we are. We have algorithm, future, hmm, iostream, vector, and thread. We have this function here, square, that's still empty, doesn't have anything in it. We have a collection of vector event numbers. We also have a collection of vector of future int which is called futures. We have a comment here that we need to launch task concurrently, and we'll get to that in just a minute. We have some more vectors. We're going to do a gather results from the futures, and then we're going to print everything out so that we can see what it is. So let's go ahead and start filling stuff in. We are going to begin with square, and square is going to do a std::cout. I'm going to say squaring space X, and X is the parameter that is passed into this function. And we're going to figure out what thread we're in. So we're going to do std::this_thread…
Contents
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Advanced coroutines and asynchronous programming39s
-
(Locked)
Lazy sequence generator with co_yield8m 2s
-
(Locked)
Asynchronous task management with coroutines10m 18s
-
(Locked)
Combining coroutines with lazy evaluation for efficient task execution4m 13s
-
(Locked)
Handling concurrent tasks in a functional manner7m 30s
-
(Locked)
Challenge: Asynchronous task manager59s
-
(Locked)
Solution: Asynchronous task manager4m 27s
-
(Locked)
-
-