Results 1 to 4 of 4

Thread: Making Qt SOAP synchronous / efficiency of an empty while loop in a QThread ?

  1. #1
    Join Date
    Nov 2007
    Posts
    53
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Making Qt SOAP synchronous / efficiency of an empty while loop in a QThread ?

    Hi,

    In my app, I used gSOAP for a long time, which make blocking calls, so it was perfect for my traditionnal QThread design.

    I have noticed a problem, on most Linux platform (and Mac OS X I think), but not on Windows, where a float was truncated by the simple fact of instanciating a QApplication object... quite problematic...

    So, I would like to use Qt Soap instead but this last one works in an asynchronous fashion and I don't want to reafactor all my app for the moment.

    Can I have performance problems with an empy while loop like this, that wait for the answer of the SOAP server ?

    Qt Code:
    1. http.submitRequest(request, "/");
    2.  
    3. while(!http.networkReply())
    4. {
    5.  
    6. }
    7.  
    8. // Dealing with the result
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Making Qt SOAP synchronous / efficiency of an empty while loop in a QThread ?

    Yes, an event loop is blocked. Add to loop one line :
    Qt Code:
    1. QApplication::processEvents();
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Nov 2007
    Posts
    53
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Making Qt SOAP synchronous / efficiency of an empty while loop in a QThread ?

    Thanks for your answer, I did not thought about this method...

    Even in a QThread this is problematic ?

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Making Qt SOAP synchronous / efficiency of an empty while loop in a QThread ?

    Every thread has own event loop. All asynchronous processes are working with events. How http object can deal with events if You block event loop ?
    By the way. It will be better to refactor Your code to properly work in event driven world

Similar Threads

  1. QThread event loop blocking the GUI
    By JoeMerchant in forum Qt Programming
    Replies: 4
    Last Post: 18th July 2009, 07:54
  2. QThread event loop seems blocked
    By eurodatar in forum Qt Programming
    Replies: 3
    Last Post: 6th May 2009, 16:50
  3. Replies: 4
    Last Post: 26th June 2008, 18:41
  4. Making 3D controls in QT, implementing a game loop in QT
    By smurrish in forum Qt Programming
    Replies: 10
    Last Post: 26th April 2006, 04:37
  5. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55

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.