This commit is contained in:
qorg11 2021-12-19 13:26:43 +01:00
parent 51c5019034
commit b4802ab2ad
No known key found for this signature in database
GPG Key ID: 343FC20A4ACA62B9
2 changed files with 9 additions and 9 deletions

View File

@ -14,10 +14,10 @@ Let's be honest, no matter how much you love C, you have to recognize
that the pthreads API are garbage. But C++'s threads API is much
better:
~~~{.c++ .numberLines}
#include <iostream>
#include <thread>
#include <mutex>
~~~{.cpp .numberLines}
#include <iostream>
#include <thread>
#include <mutex>
int j = 10;
@ -64,9 +64,9 @@ As far as I know, C doesn't have this (well, it does but as state
above you'll have to have a lot of patience to work with
pthreads). but C++ does.
~~~{.c++ .numberLines}
#include &lt;iostream&gt;
#include &lt;future&gt;
~~~{.cpp .numberLines}
#include <iostream>
#include <future>
int
do_stuff()
@ -77,7 +77,7 @@ do_stuff()
int
main()
{
std::future&lt;int&gt; 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;

View File

@ -83,7 +83,7 @@ You have to compile it so it's a shared library:
`gcc -fpic -shared file.c -o libfile.so`
file.perl:
file.raku:
~~~{.perl .numberLines}
use NativeCall;