Hi,
I have written an application where the UI receives data from a working thread. The working thread is in fact a communication thread (using a socket) but this does not change my problem.
So, in my application, there is the main thread that manages the UI and another one that provides data to be displayed by the UI. The working thread uses pub.sendMessage(wx.CallAfter, …) to send data to the UI thread. Essentially, the UI components that are updated with data are TextCtrl.
All in all, this works, but… when the working thread sends too many data to the UI thread, the UI becomes unresponsive. I don’t have any numbering for “too many” but it is not so high. It looks like it is quite variable. The data throughput varies over time. At startup, it is high, then is low. It can be high from time to time. Unresponsive means Windows tells the application is unresponsive, UI is not updated and user inputs are not working.
I’ve tried many strategies to avoid this problem without success. Either the UI is unresponsive at some point, either the data rate is too low.
I have tried to put the working thread in a process. I use a queue to transfer data and a thread to read the queue and give data to UI thread (using pub.sendMessage(wx.CallAfter, …)).
The problem is still there.
So, how can I automatically regulate the data throughput sent to the UI thread to always have a responsive UI and with the higher throughput possible ?
All ideas are welcome
Nicolas