I am weighing out the necessity of threading a network interface to my Qt based application. I currently have implemented in the main GUI thread a QUdpSocket, and am depending upon the standard asynchronous call back readDatagram() in response
to the readyRead()SIGNAL from the socket to process content from a separate board connected over a network connection. This activity is currently executing within the main GUI thread.
I need to expand my implementation such that within the readDatagram() function I can dispatch several different types of messages to separate queues with associated worker threads. The message dispatching will be based on signatures of the content of the messages themselves.
I need to have the main GUI thread act in a somewhat synchronous blocking mode when the user picks certain GUI elements. This will require that the application communicate with another board, and only upon receipt of information from this other
board, can the GUI change state. The state change is based on the data received from the other board, which specifies the content dynamically for the next displayed screen.
The GUI then has the behavior of synchronous blocking while this volley of information with the other board is occurring (or a timeout condition occurs).
While this synchronous blocking behavior is occuring, I need to continue to feed other messages from the network dispatcher on to the other "background tasks". These tasks could be used for USB media writes, debug logs, etc.
My concern would be that while my main GUI thread is pending upon a message reception in a blocking manner, the signal handler for reception of additional UDP content would not be timely. I suppose I would have more insight on to whether this could be a potential problem if I knew more of the nature of QUdpSocket and whether it is implemented already as a separate thread through the class derivation to QAbstractSocket to QIODevice. I can not ascertain from inspection of the source code.
I am interested in what type of design would be the most flexible and future safe.
Bookmarks