Results 1 to 5 of 5

Thread: Thread stops after a while in release mode

  1. #1
    Join Date
    Jul 2010
    Location
    POLAND
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Thread stops after a while in release mode

    Hi everyone!

    I have experienced strange behaviour of my multi-threaded application I cannot explain.
    It works fine when compiled in debug mode, but when it is compiled in release mode (on Windows XP) and then run it looks that the threads (I have about 20 of them) stop one by one in periods of several seconds.

    I've found out in QT docs that some OS may have limitations on how many threads can the application have. But I haven't found anywhere how many it is on Win XP. Does any of you have experiance with that number of threads on Windows XP to share your experiance with me please? And why they stop not straight ahead, but after a while and only in release mode??? I have no clue

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Thread stops after a while in release mode

    I would rather look for a life-lock in your code and not a limit for the number of threads that can be spawned at the same time. I assure you there is no problem in running several hundreds threads on a Windows system. Of course there is also another issue - do you have >20 processors in your system? If not then it is nothing unexpected that not all threads run at the same time.
    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.


  3. #3
    Join Date
    Jul 2010
    Location
    POLAND
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Thread stops after a while in release mode

    Thanks for your answer wysota. I'll check about live-lock. I don't even know that there is a thing like live-lock so I didn't implement it explicitally, but maybe there is some default setting for this? I'll try to find out.
    I have one processor and of course I know that the threads are not really running simultanously (I even rised a question about how prcessor time is shared in replay to your post: http://www.qtcentre.org/threads/3228...inside-another), but inmy program problem is that at the beginning they all run, but then switch off one by one. But what I can't understand most is what for the hell it is only in release mode. I'll check against live-lock and let you know when I solve it.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Thread stops after a while in release mode

    Quote Originally Posted by huba View Post
    don't even know that there is a thing like live-lock so I didn't implement it explicitally
    It's not something you implement, it's something you might get when your code is incorrect It is similar to a dead-lock situation which occurs when one object (thread) can never gain access to a resource (CPU, printer, file, whatever) it needs because it is always blocked by some other object. A life-lock is a situation when theoretically it may happen that the object gets access to the resource but in practice it never (or very rarely) happens and the object can never complete its task in expected time.
    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.


  5. #5
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Thread stops after a while in release mode

    Thread can be stopped when an exception was thrown in it. Surround whole thread's run function with try/catch(...) and log out an error message in catch section.
    Now about debug and release. In release mode your code computes faster and memory layout is more compact, then in debug one.

Similar Threads

  1. Replies: 4
    Last Post: 27th May 2010, 15:18
  2. Replies: 1
    Last Post: 2nd November 2009, 12:02
  3. Replies: 9
    Last Post: 15th April 2009, 06:23
  4. Not able to execute in Release Mode
    By sudheer168 in forum Qt Programming
    Replies: 4
    Last Post: 18th March 2009, 11:58
  5. Replies: 8
    Last Post: 10th October 2007, 18:20

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.