Results 1 to 10 of 10

Thread: QThread : how to stop an infinite loop

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QThread : how to stop an infinite loop

    ok. So maybe is that such code is not in run() then stop() does not work. Try by subclassing QThread and put that code in run(). Then start the thread with start(). Those many pointers and metaobjects invokes are really don't needed.

    Qt Code:
    1. class MyThread : public QThread
    2. {
    3. public:
    4. void run();
    5. };
    6.  
    7. void MyThread::run()
    8. {
    9. //My massive process here
    10. }
    To copy to clipboard, switch view to plain text mode 

    Carlos

  2. The following user says thank you to qlands for this useful post:

    TarielVincent (24th February 2012)

Similar Threads

  1. Infinite loop in QXmlSchemaValidator::validate()?
    By TropicalPenguin in forum Qt Programming
    Replies: 0
    Last Post: 9th November 2010, 15:09
  2. infinite loop
    By zakis in forum Qt Programming
    Replies: 1
    Last Post: 4th November 2009, 17:52
  3. Replies: 4
    Last Post: 19th August 2009, 19:38
  4. Infinite loop - resize parent from child
    By bitChanger in forum Qt Programming
    Replies: 3
    Last Post: 5th May 2006, 13:21
  5. is it possible to stay on a user defined infinite loop?
    By mahe2310 in forum Qt Programming
    Replies: 9
    Last Post: 24th March 2006, 14:29

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