当我std::call_once在 Linux 2.6.36 版中使用时,出现错误:
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Aborted
Run Code Online (Sandbox Code Playgroud)
编译命令:
mipsel-buildroot-linux-uclibc-g++ callonce.cpp -o callonce -static -lpthread
Run Code Online (Sandbox Code Playgroud)
我的代码:
#include <iostream>
#include <mutex>
using namespace std;
int main()
{
cout << "Hello world" << std::endl;
static once_flag of;
call_once(of,[]{});
return 0;
}
Run Code Online (Sandbox Code Playgroud)