added two threading examples
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
//This function will be called from a thread
|
||||
|
||||
void call_from_thread() {
|
||||
std::cout << "Hello, World" << std::endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
//Launch a thread
|
||||
std::thread t1(call_from_thread);
|
||||
|
||||
//Join the thread with the main thread
|
||||
t1.join();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user