|
|
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » howto best Ctrl Refresh handling w/ MT & very frequent refreshes
Re: howto best Ctrl Refresh handling w/ MT & very frequent refreshes [message #26975 is a reply to message #26974] |
Wed, 16 June 2010 11:18   |
|
kohait00 wrote on Wed, 16 June 2010 09:56 | how to keep the queue busy so ith wont trigger a refresh each and everytime.
imagine: 50 devices push their live monitoring data (acutally not the problem, 48 bytes only) to the gui, where the data income is linked to Ctrls (SetData, SetText, cusom Ctrls as well) for each device separately. the devices fire unsynchronously, more or less every 200 ms.
==> consequence: Refreshes over and over (even with 4 devices its a problem already), because queue is kept empty..any idea about that?
|
Hi Kohait,
Thanks for better description of the problem. I still think that this is not a problem of how to refresh Ctrls... It is about the app design. You can solve your problems by altering it just a little bit.
What you need is not to feed the incoming data directly into GUI. If I understand correctly, you know very well what is coming from "outside", so it should not be a problem to create some structure representing those 48b of information. Doing this of the screen is very fast. Now all these structures, one for each device, can reside in Vector. If you use one thread per device there should not be no problem with MT.
Then you can just create a function that will iterate through this array and update the Ctrls based on its content. This function can be called using PostCallback. To make it really MT safe you can use some kind of locking (to prevent writing into the structures or to pause receiving new data). If you refresh "only" 10-20 times per second (which is more than enough for human eye, I usually aim for ~5fps), it should not bring any performance problems.
Well, at least that is what I would do 
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Mon Apr 28 10:11:35 CEST 2025
Total time taken to generate the page: 0.01017 seconds
|
|
|