Enable multithreading to use std::thread: Operation not permitted
简单示例
#include <iostream>
#include <thread>
void hello() {
std::cout << "hello world" << std::endl;
}
int main() {
std::thread t(hello);
t.join();
}
编译命令:
g++ -std=c++11 hello.cpp -o hello -pthread
C++支持多线程,有三点注意:
包含
原创
2021-04-28 19:54:19 ·
2643 阅读 ·
0 评论