Results 1 to 4 of 4

Thread: Checking progress efficiently | C++

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Posts
    23
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    16

    Question Checking progress efficiently | C++

    Hello everyone,

    I'm working with a function that, for instance, does some task it it's own thread and takes the address of an int for progress. Like so:

    void doSometing(int* progress)

    So, While the function is off running, I need an efficient way to check the progress for completion so that I may process the next item. I was doing something like this:

    Qt Code:
    1. while(progress < 100)
    2. {
    3. progressBar->value = progress
    4. }
    To copy to clipboard, switch view to plain text mode 

    That just seems like a bit much. But if I only check it every, say, 10 seconds, I could conceivably be wasting 9 seconds for every item. So, is there an accepted way to do something like this?

    Thanks for your time,
    Backslash
    Last edited by jpn; 21st February 2008 at 20:18. Reason: missing [code] tags

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.