Access server or proxies via multiple Qt threads

Good day.

I have a custom C++/Qt client application that uses Paraview to connect to a PVServer instance. I have multiple Qt windows to display data. I have an expensive filter that I want to apply to one set of data. However, while this expensive filter operation takes place on the server, I would like to pass off the client side part of that to another thread (using QThread or QtConcurrent or the like) so that I can continue to use the other windows in my program. If done sequentially, the expensive operation blocks all other actions on the entire program. But the moment I interact with a proxy in the separate thread from the thread that initialised the first server connection, even if that separate thread created, instantiated, and owns the proxy in question, the program will end with a SIGSEGV error.

I am aware of the Paraview Async blog (as mentioned here), and it seems to indicate that the proxies are not thread safe. I thought by instantiating and creating the proxies in the separate thread I could get around the issue (since proxies weren’t shared across threads or communicating across threads), but this proved to not be the case.

So my questions are: is it at all possible to interact with the server through multiple threads of the same program? And if so, how would I do it? Do I need a separate call to pqApplicationCore::instance()->getObjectBuilder()->createServer() for each thread, rather than pqActiveObjects::instance().activeServer()?

Thank you for your time.

1 Like