blob: 1caa73da32035f7cdd3a538e9a227b4983b18dcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#include <unistd.h>
#include <iostream>
#include <thread>
int main(void) {
std::cout << "Before thread" << std::endl;
std::thread t([]() {
sleep(1);
std::cout << "In a thread." << std::endl;
});
t.join();
std::cout << "After thread" << std::endl;
}
|