Results 1 to 11 of 11

Thread: Worker thread doesn't seem to start event loop?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Worker thread doesn't seem to start event loop?

    The thing is that I need them because I test my algorithms performances for some research and they all have a computational budget of X seconds. So I need QTimers for each to use that precise amount of time and not more...
    Looks like you want some time based scheduling which makes sure that algorithm doe not run for more than X seconds. or may you just want to measure the time consumed by each algorithm. In either cases QTimer will not help, you have use QTime
    Qt Code:
    1. t.start();
    2. some_lengthy_task();
    3. qDebug("Time elapsed: %d ms", t.elapsed());
    To copy to clipboard, switch view to plain text mode 
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  2. #2
    Join Date
    Aug 2013
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Worker thread doesn't seem to start event loop?

    That's perfect ! I didn't know about QTime, this should do the trick !
    Thanks again for everything

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Worker thread doesn't seem to start event loop?

    Or even QElapsedTimer if you don't need to convert into hours/minutes/seconds and just want the most efficient class http://qt-project.org/doc/qt-5.0/qtc...psedtimer.html

    Cheers,
    _

  4. #4
    Join Date
    Aug 2013
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Worker thread doesn't seem to start event loop?

    Indeed, it's even better for my use! Thank you

Similar Threads

  1. Replies: 5
    Last Post: 22nd June 2012, 16:40
  2. Replies: 5
    Last Post: 8th February 2012, 09:56
  3. Event loop does not start
    By koan in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 31st August 2010, 14:26
  4. Replies: 10
    Last Post: 15th January 2010, 14:35
  5. Main Thread Event loop
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2007, 12:10

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.