Results 1 to 2 of 2

Thread: threads won't finish when reading data from file

  1. #1
    Join Date
    Jan 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default threads won't finish when reading data from file

    Hey,
    i got some problems here, but cannot find any answer (googled for a while now)

    I'm doing some parallel calculation with QFutureWatcher. Basically it works fine, but if I fetch some global parameters from a file before I start the calculation, the threads of the watcher won't finish anymore.
    at the moment I use QSettings to read the file, but it also happened with QFile.
    If I remove the code which reads the file it everything works fine.

    Am I missing something?

    The Code to read the file:
    Qt Code:
    1. QString fileName=QFileDialog::getOpenFileName(this,tr("load magnets ..."),QDir::homePath(),tr("File (*.ini)"));
    2. if(fileName.length()>0) {
    3. QSettings *settings = new QSettings(fileName,QSettings::IniFormat);
    4. QStringList list_of_magnets = settings->childGroups();
    5. foreach (QString magnet, list_of_magnets) {
    6. settings->beginGroup(magnet);
    7. addMagnet( ... );
    8. settings->endGroup();
    9. }
    10. delete settings;
    11. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: threads won't finish when reading data from file

    Step through and see if it hangs on a call (as in dead lock) or loops somewhere for ever...
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 6
    Last Post: 24th November 2010, 18:59
  2. Reading data from xls file
    By addu in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2010, 09:33
  3. reading data from file
    By offline in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2010, 10:31
  4. How do I access data between threads
    By yodasoda in forum Qt Programming
    Replies: 3
    Last Post: 26th February 2010, 19:10
  5. Reading/writing data to binary file
    By DiamonDogX in forum Qt Programming
    Replies: 3
    Last Post: 23rd July 2009, 19:24

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.