知道为什么这个与std :: thread相关的代码在LiveWorkSpace.org 上使用gcc 4.7.2编译但在Ideone.com和我的Ubuntu 12.04机器上运行
terminate called after throwing an instance of 'std::system_error'
what(): Operation not permitted
代码测试(在所有情况下都是gcc 4.7.2) -
#include <string>
#include <iostream>
#include <thread>
void task1(std::string msg)
{
std::cout << "task1 says: " << msg<<std::endl;
}
int main()
{
std::thread t1(task1, "Hello");
t1.join();
return 0;
}