I have a crash in an external mathematical library when I use it from a separate thread than the main one, while it works perfectly if I call it from the main thread.
I know this library is not multi-thread, but it is used in a sequential way using a single thread. Neverless it crashs when comparing the time elapsed using CPU clocks.
Can someone explain me why this code is wrong, or if you think it is a bug in the external library or in the qt thread library?
Attached there is a complete compilable (small) example, but the core of the code is:
int main(int argc, char *argv[]){
cout << "Test on a glpk application using Qt Threads" << endl<<endl;
Thread wThread; // subclass QThread just for the run() method.
for (uint y=0;y<5000;y++){
wThread.start(); // just calls the glpk simple documentation example
wThread.wait();
}
cout <<"All done without errors (crashing)"<<endl;
return 0;
}
int main(int argc, char *argv[]){
cout << "Test on a glpk application using Qt Threads" << endl<<endl;
Thread wThread; // subclass QThread just for the run() method.
for (uint y=0;y<5000;y++){
wThread.start(); // just calls the glpk simple documentation example
wThread.wait();
}
cout <<"All done without errors (crashing)"<<endl;
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks