Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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 Wink

Best regards,
Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GtkWidget inside U++
Next Topic: DONE: ColumnList with Ctrl's
Goto Forum:
  


Current Time: Tue May 07 18:01:56 CEST 2024

Total time taken to generate the page: 0.01891 seconds