mercredi 16 décembre 2020

terminate called after throwing an instance of 'std::system_error'

When i use std::call_once in Linux version 2.6.36,it makes an error:

terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Aborted

Compile command:

mipsel-buildroot-linux-uclibc-g++ callonce.cpp -o callonce -static -lpthread

my code:

#include <iostream>
#include <mutex>
using namespace std;
int main()
{
    cout << "Hello world" << std::endl;
    static once_flag of;
    call_once(of,[]{});

    return 0;
}

Aucun commentaire:

Enregistrer un commentaire