mirror of git://git.qorg11.net/kill9.git
whoops
This commit is contained in:
parent
51c5019034
commit
b4802ab2ad
|
@ -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 <iostream>
|
||||
#include <future>
|
||||
~~~{.cpp .numberLines}
|
||||
#include <iostream>
|
||||
#include <future>
|
||||
|
||||
int
|
||||
do_stuff()
|
||||
|
@ -77,7 +77,7 @@ do_stuff()
|
|||
int
|
||||
main()
|
||||
{
|
||||
std::future<int> 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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue