gcc 4.7.2实现有什么不同吗?

时间:2013-02-22 13:29:46

标签: c++ gcc4.7

知道为什么这个与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;
}

0 个答案:

没有答案