June 14th, 2011, 06:55 AM
Background Threads and UI refresh issue.
A C# development project (VS 2010), performing data collection with analog to digital device, on three 'channels'. Device requires polling so a background thread polls and buffers current device state into 3 List<>.
UI, component moves desired List<> into strip chart component.
This works well.
UI contains TAB control, for user to context switch between the three lists/streams of data. Each tab page takes FOREVER to refresh/redraw. Even on form init. (which may be acceptable to stream buffering delays) but should not be present once app settles into load.
Of interest is that while profiling application to identify possible bottleneck, app works perfectly?
How should one properly instrument background threads.
What is profiler introducing that would 'hide' this refresh delay.
PS, there is one delegate/invoke from the worker thread back to the UI layer, which seems to take considerable time. All information says using this invocation approach is best soltution to having threads update UI controls.
ALL Responses are appreciated and welcome.
June 14th, 2011, 07:13 AM
Re: Background Threads and UI refresh issue.
I failed to mention that standard locking device is used to protect List<> between polling and UI. I assume it is this lock that may be blocking the UI, but would like to confirm before altering code.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!