This commit is contained in:
Light-City
2020-03-03 10:00:10 +08:00
parent 535b75acfa
commit 16c12a3bc6
38 changed files with 349 additions and 22 deletions

View File

@@ -0,0 +1,20 @@
//
// Created by light on 19-11-5.
//
#include <iostream>
#include <thread>
#include <unistd.h>
using namespace std;
void hello() {
cout << "hello world" << endl;
}
int main() {
thread t(hello);
t.join(); // must add this line otherwise will failed!
// 需要注意的是线程对象执行了join后就不再joinable了所以只能调用join一次。
return 0;
}