0

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

0 回答 0