diff --git a/rocks/computers/software/langs/c++.md b/rocks/computers/software/langs/c++.md index a689b21..d581088 100644 --- a/rocks/computers/software/langs/c++.md +++ b/rocks/computers/software/langs/c++.md @@ -16,9 +16,9 @@ that the pthreads API are garbage. But C++'s threads API is much better:
-#include-#include -#include +#include <iostream> +#include <thread> +#include <mutex> int j = 10; @@ -66,8 +66,8 @@ above you'll have to have a lot of patience to work with pthreads). but C++ does. -#include-#include +#include <iostream> +#include <future> int do_stuff() @@ -78,7 +78,7 @@ do_stuff() int main() { - std::future future = std::async(do_stuff); + std::future<int> future = std::async(do_stuff); std::cout << "do_stuff() is being executed in the background" << std::endl; std::cout << "The return value of do_stuff is: " << future.get() << std::endl; return 0;