Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt Remote Object call Slot synchronicity
Daes last edited by
That is Qt Remote Object subject:
After some test, it appears that:
It seems not possible to enableRemote an object that is not in the Host thread (the enable remote seems parenting some QObject to remoted object)
The call of a remoted object slot (even with no return value) is blocking the host thread, so the object thread, (see 1)
That seems to mean that each slot call from remoted is blocking the complete RO traffic on the host, so nothing can happen between the start of the slot call and the end (tried a slot with QThread::a sleep(30), everything is locked)
Could someone confirm or infirm these facts?
Is there a way i didn't see to enableRemote object from other threads?
Is there a way to remote call a slot with return value asynchronously (on host side as, it is already asynchronized on client side) (without locking the host thread) ?
The best would be to have the slot executed in the object thread (or in a threadpool) and the result returned asynchronously to the host thread that would send it back to client node (that is async itself).
Thats seems to me impossible to be stuck on that, considering qt and its async philosophy.
Please tell me there is a way ;)
Daes last edited by
I have a concrete example of the problem:
I have a Remote network with a lots of Node.
One of the node had an Object remoted that had a slot with a mutex interlock problem that appears on particular conditions (a bug of mine ;) )
The call of this slot on this object from one replica had caused the complete lock on all the communication of the RemoteObject network.
It seems to me not too robust.
I think that no operation should be blocking on the network layer.
One half-solution to make the network more responsive and robust would be to declare a thread for each iodevice socket. It could, at least only lock one part of the network, but :
- How will the host react when it will have to enableRemote from another thread (see 1) on the above post.
- It is more complex with TCPServer - not possible in my knowledge on WebServerSocket
- It is not thinkable with network with a lot of nodes (on thread for each connection ?)
Do someone have information about how to use the RemoteObject network asynchronously?
If there is no way, i think i will declare a bug.