I've a couple of questions about event-driven programming.

I was recently handed some code the uses QNetworkAccessManager to communicate with a RIAK TS database. After calling QnetworkAccessManager:ost(...), the author creates and event loop and waits for the QNetworkReply to finish. This approach is problematic because this code is being inserted into a GUI application, which of course has its own event loop. I've experienced cases where the author's event loop never returns; resulting in an application hang.

My first question is: Are event loops within event loops a bad practice in event-driven programming?

The second question is how to handle an operation that could take awhile or never produce a result?

I am working on an Open function that must query the RIAK database for a list of data sets to open. Since the operation is not guaranteed to return immediately (or at all), I'd like to know how I should approach handling it. Right now, I am thinking that I need to break the Open function into smaller functions and somehow connect those functions to the results of the query. But then the Open function seems like it should be atomic…

Not sure how to handle this, and am looking for advice.