lundi 27 juin 2016

An error("File size limit exceeded") when using thread of C++11

I am learning C++ multithread programing, here is my code:

#include <iostream>
#include <thread>
using namespace std;

void hello() {
    cout<<"hello world"<<endl;
}
struct func {
    int& _i;
    func(int& i ):_i(i){}
    void operator() (){

        for(unsigned int i = 0; i < 1000000; i++) {
            cout<<&_i<<endl;   
        }                                      
    }
};
int main() {
    int i = 0;
    thread t{func(i)};
    t.join();
    return 0;
}

When i run it, the program is terminating with error "File size limit exceeded".

Aucun commentaire:

Enregistrer un commentaire