I am building an application where it is possible to monitor some MCU hardware (sensors readings etc) in real time. For the communication I am using a CAN bus.
Basically i have 2 threads as of now. One is the main thread where the GUI is running and the other is managing/monitoring the communication between the device. So the obvious thing is that i need to pass the data from the communications thread to the gui thread. However what should be the right way to do it? I know how to pass a data back to the calling thread when the child thread has finished working, but in this case the communications thread is running all the time.
Of course the communications logic is represented by a separate class (CANManager).
I have couple of ideas of my own, however I would like to know what is the "right" way how this should be done.
Thanks in advance :)