Results 1 to 2 of 2

Thread: External libary in a separate thread: is this correct?

  1. #1
    Join Date
    Dec 2007
    Location
    Ancona, Italy
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy External libary in a separate thread: is this correct?

    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:
    Qt Code:
    1. int main(int argc, char *argv[]){
    2.  
    3. cout << "Test on a glpk application using Qt Threads" << endl<<endl;
    4. Thread wThread; // subclass QThread just for the run() method.
    5. for (uint y=0;y<5000;y++){
    6. wThread.start(); // just calls the glpk simple documentation example
    7. wThread.wait();
    8. }
    9. cout <<"All done without errors (crashing)"<<endl;
    10. return 0;
    11. }
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: External libary in a separate thread: is this correct?

    Please don't start multiple threads on the same subject.

    http://www.qtcentre.org/forum/f-qt-p...ock-22171.html
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Advice needed regarding GUI and external thread cooperation
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 17th June 2009, 00:10
  2. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 17:50
  3. Replies: 16
    Last Post: 23rd May 2008, 10:12
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. Replies: 10
    Last Post: 20th March 2007, 22:19

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.