Results 1 to 3 of 3

Thread: Detect conflicting thread

  1. #1
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Detect conflicting thread

    Hi all.
    After reaching more than 20k lines of codes I am messing up with a problem very strange.
    If I run my program, in very particular situations (depending on the speed of typing input text and hitting the Enter key) the UI freezes, like stayng in a loop.
    On the other hand, if I wait a while, before hitting the Enter key, in most of cases the UI does not freeze.
    I can guess which class "disturb", because if I do not use it, everything is ok. (For instance the class uses a QTimer).
    There is way to detect which class are conflicting at runtime, or which threads? (in linux).
    Thank you.

  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: Detect conflicting thread

    Debugging threads is one of the hardest things.
    The fact you change something (like taking that class out) doesn't necessarily mean the problem has to do with that class, it simply means, that the application behavior is changed and thus the the dead-lock (it seems) doesn't appear any more, at least not with the same characteristics (maybe it will freeze but much later?).
    You could just as well run the original code on a different machine, and a different behavior might be observer as well.

    What you are describing sounds very much like a dead lock.

    You have to make sure, that all the mutual used code between threads is guarded by mutexes semaphores or any similar mechanism - that would be the first step.

    It is virtually impossible to help you more with out seeing the code, but 20k lines of code is really a problem.

    How large is the code that has to do with the threads?
    If its not too much, may be you can post it, and it will help us help you.
    ==========================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.

  3. #3
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Detect conflicting thread

    I explained myself in an uncorrect way.
    My application is just one big thread ( I used mistakenly the word thread).
    Fortunately, I figured out what what the problem. A while condition which in some special cases does not exit.
    Practically, if I type the input so fast, it could happen that non data were available to the while loop in order to exit.
    Any way, thank you.
    G

Similar Threads

  1. Thread Ownership Problem
    By tntcoda in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2009, 00:18
  2. Thread Help
    By tntcoda in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2009, 22:10
  3. Thread, Timer and Socket. Comuication problem
    By ^NyAw^ in forum Qt Programming
    Replies: 6
    Last Post: 17th January 2008, 16:48
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49

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
  •  
Qt is a trademark of The Qt Company.