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 ?
Code:
http.submitRequest(request, "/");
while(!http.networkReply())
{
}
// Dealing with the result
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 :
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 ?
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 :)